• maxm avatar
    tinygoHttpExample
    @maxm
    A Go http handler running in Val Town: The Go source is here . Mandelbrot rendering code taken from here . I used maxm/compileAndUploadTinygoWasm to compile the code and create the val. $ git clone git@github.com:maxmcd/go-town.git $ cd go-town/val-town-tinygo-http-example $ deno run --allow-net --allow-run --allow-read "https://esm.town/v/maxm/compileAndUploadTinygoWasm?v=58" Running tinygo build -o main.wasm -target=wasi . Compliation complete Running wasm-strip main.wasm Copy the following into a val town HTTP val: 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); }
    HTTP
  • stevekrouse avatar
    tinygoMandelbrotExample
    @stevekrouse
    Forked from maxm/tinygoHttpExample
    HTTP
  • maxm avatar
    tinygoWasmHelloWorld
    @maxm
    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"
    HTTP
  • maxm avatar
    aquamarinePiranha
    @maxm
    An interactive, runnable TypeScript val by maxm
    HTTP
1
Next
May 24, 2024