- This project has been moved into workers repository.
Legacy Docmentation
- A template for starting a Cloudflare Worker project with tinygo.
- This template uses
workers
package to run an HTTP server.
main.go
includes simple HTTP server implementation. Feel free to edit this code and implement your own HTTP server.
- Node.js
- wrangler
- just run
npm install -g wrangler
- just run
- tinygo
$ git clone https://github.com/syumai/worker-template-tinygo my-app
$ cd my-app
$ go mod init
$ go mod tidy
$ make dev # start running dev server
$ curl http://localhost:8787/hello
Hello!
- To change worker name, please edit
name
property inwrangler.toml
.
make dev # run dev server
make build # build Go Wasm binary
make publish # publish worker
- Just send HTTP request using some tools like curl.
$ curl http://localhost:8787/hello
Hello!
$ curl -X POST -d "test message" http://localhost:8787/echo
test message