Readme

Tinygo Wasm Example

Go Source:

package main

import (
	"fmt"
	"net/http"
	gotown "github.com/maxmcd/go-town"
)

func main() {
	gotown.ListenAndServe(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "Hello World")
	}))
}

Built with:

 deno run --allow-net --allow-run --allow-read \
    "https://esm.town/v/maxm/compileAndUploadTinygoWasm?v=58"
1
2
3
4
5
6
import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
const resp = await fetch("https://maxm-wasmBlobHost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
export default async function(req: Request): Promise<Response> {
return handler(req);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
maxm-tinygowasmhelloworld.web.val.run
v10
May 24, 2024