Demo application using vercel serverless functions to create a simple API with go using chi router.
This template uses common go api practices for developing apis for deployment on vercel. When deployed on vercel, every time the serverless function is invoked, a new router is created and the current request is matched against it.
If you have a small api with not a lot of traffic, this template and serverless functions in general are right for you.
If you have a lot of traffic or have a lot of external dependencies (Databases, external APIs, ...) then you might use a real server.
For example if you have are connecting to a database, vvery time the serverless function is invoked, a new connection to the database will be created and destroyed afterwards. This can create a bottleneck in a high traffic environment.
- Go - Programming language
- Chi - Router
- Vercel - Serverless functions
- Magefile - Task executor
- Dagger - CI
- Github Actions - CI executor
To use this template, you can click on the "Use this template" button or clone it using git:
git clone https://github.com/ngoldack/vercel-go-chi.git
To run this application locally, you need to have Go and Magefile installed.
If you want to run the CI locally, you also need Docker and Dagger installed.
mage -v dev
mage -v test
Requires docker
and dagger
installed.
dagger run go run ci/main.go