This is an example of getting POST data from the Spin implementation of Router.
Spin uses itt-router 3, but it is easier to use the Spin primitives to get the post body than it is to use itty-router middleware from within Spin. This shows how it is done.
The index.ts has all you need.
You will need Spin 2.0 or greater.
- Clone this repo
- Run
npm install
- Build and run the program with
spin build --up
Now you can use a curl
call to execute a test POST request:
$ curl -XPOST http://localhost:3000/example --data 'Hello World'
Hello World
- For background, see fermyon/spin-js-sdk#132
- For more documentation, see https://developer.fermyon.com/spin/v2/http-trigger