URL shortener: Difference between revisions
m
→{{header|Wren}}: Minor tidy
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 982:
{{libheader|Wren-json}}
An embedded program with a Go host so we can use its net/http module.
<syntaxhighlight lang="
import "./json" for JSON
Line 1,043:
}</syntaxhighlight>
We now embed this script in the following Go program and build it.
<syntaxhighlight lang="go">/* go build
package main
Line 1,058:
type any = interface{}
var fileName = "
var host = "localhost:8000"
Line 1,158:
Sample output (abbreviated) including building and starting the server from Ubuntu 20.04 terminal and entering a valid and then an invalid shortened URL:
<pre>
$ go build
$ ./
$ curl -X POST 'localhost:8000'/ \
|