Simple:
npm install
npm start
With a file watcher (nodemon
)
npm run start:dev
Api starter use PM2. You can start it with the Dockerfile provided
docker build -t api-starter .
docker run -p 80:3000 -d api-starter:latest
Easily customizable configuration.
With a .env
file in the project root folder
#.env
PORT=3210
Or with environment variables
# Export a variable
export PORT=3210
npm start
# Directly in one command
PORT=3210 npm start
The awesome GraphQL-starter provide an healthcheck mecanism By default
http://localhost:3000/health
{
"name": "api-starter",
"version": "0.0.1",
"checkers": [{ "name": "status", "value": "OK" }]
}
Healthcheck path can be configured
app.use(health('/ping')
Custom checkers can easily be added
app.use(health('/ping', [
async (ctx, next) => {
const status = await fetch(serviceUrl).then(res => res.json())
ctx.body = {
name: 'custom-check',
status
};
next();
}
])