An example endpoint built using Merapi, the JavaScript framework for microservices made by Kata.ai
First, make a copy of the .env.example
file and name it .env
. This file will be used to host our
environment variables, e.g. service URL, port, etc.
Then, install the required dependencies using your preferred package manager.
yarn
# or, for npm:
npm install
And finally, run the following command to start the TypeScript watcher + Merapi server.
npm run watch
Your server now lives at the port that you set on your .env
file (defaults to 9300
).
GET /
(andGET /info
) - simple healthcheckGET /api/v1/hello
- returns a JSON payload with hello messageGET /api/v1/hello/:toWho
- same as above, but with a customisable param
If you use now, this repository is instantly deployable. Just click the button below.
Now has its own way to manage environment variables and deployment secrets. To learn more about it, follow this guide.
Once you've created a secret through the Now CLI, include it in your now.json
as follows:
{
"env": {
"ENV_VARIABLE": "@secret-name"
}
}
More deployment guides for other environments will be made available when needed.