This project showcases how to do internal HTTP routing in a Spin Python application. It is similar to the Spin JS router as well as the Django router.
If you are interested in extrnal routing (where the routing table is declared in the spin.toml
), the Application Structure guide covers this, as does the documentation for Spin configuration.
This uses the absolutely fantastic http_router project. You will likely want to reference the API docs:
- Install the dependencies with
pipenv update
- Build with
spin build
$ pipenv update
$ spin build
$ spin up
You can then try out some example queries:
curl localhost:3000/
curl -XPOST -d "TEST" localhost:3000/post
curl localhost:3000/queryparams\?foo=bar\&foo2=bar2
$ spin deploy
You can then adapt the above curl
requests to the URL Fermyon Cloud returned to you.