A serverless GraphQL API built with TypeScript and MongoDB
The explaination of the API can my found on my blog.
The Vercel CLI will need be downloaded, installed and logged into.
After that create a .env
file and add the DB_PATH
environment variable with the database URI.
DB_PATH=mongodb://<user>:<password>@ds123456.mlab.com:54321/example-db
Then link it to a Vercel project.
vercel link
Finally run
vercel dev
Deploying to Vercel
First upload the database path as an Environment Variable.
vercel env add
Name the variable DB_PATH
and make sure you make to available for all three environments (Production, Preview and Development).
Then all that’s left to do is to deploy to Vercel.
vercel