{"repo":"nlepage/go-wasm-http-server","free":true,"listed":false,"github":"https://github.com/nlepage/go-wasm-http-server","clone":"git clone https://github.com/nlepage/go-wasm-http-server.git","description":"Embed your Go HTTP handlers in a ServiceWorker and emulate an HTTP server!","language":"Go","stars":409,"topics":["wasm","golang","http-server","service-worker","serviceworker"],"license":"Apache-2.0","category":"networking-infra","readme_excerpt":"Welcome to go-wasm-http-server 👋 Embed your Go HTTP handlers in a ServiceWorker (using WebAssembly) and emulate an HTTP server! Examples - Hello example (sources) - Hello example with state (sources) - Hello example with state and keepalive (sources) - Hello example with Server Sent Events (sources) - 😺 Catption generator example (sources) - Random password generator web server (sources forked from jbarham/random-password-please) - Server fallbacks, and compiling with TinyGo (runs locally; see sources & readme for how to run this example) How? Below is a talk given at the Go devroom of FOSDEM 2021 explaining how go-wasm-http-server works. [!WARNING] go-wasm-http-server has suffered major changes since this talk, be aware that it is not accurate anymore on several aspects. Please refer to the documentation below for up to date usage of go-wasm-http-server . The slides are available here. Why? go-wasm-http-server can help you put up a demonstration for a project without actually running a Go HTTP server. Requirements go-wasm-http-server requires you to build your Go application to WebAssembly, so you need to make sure your code is compatible: - no C bindings - no System dependencies such as file system or network (database server for example) - For smaller WASM blobs, your code may also benefit from being compatible with, and compiled by, TinyGo. See the TinyGo specific details below. Usage Step 1: Build to js/wasm In your Go code, replace http.ListenAndServe() (or net.Listen","default_branch":null,"files":null,"tree":[],"storefront":"/r/nlepage","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nlepage/go-wasm-http-server/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}