Custom API description here.
Already configured:
typescript
: compiles to abuild
folder and has a task to watch and compile, comes with some @types in thepackage.json
jest
: already configured to run and debug typescript tests, with a route test example (usingsupertest
)log4js
: logs app and express requests to stdout, easily configured to log to a fileprettier
: forget about indentation, runs before a commitdocker
: already configured to build and run the app
node
(using v8)yarn
(faster than npm)
EXAMPLE_VAR
optional - some app secret
Environment variables can be set in the .env
file (rename the .env.example
to .env
) or in the operative system vars.
Variables in the .env
file do not override the system variables if already exists with the same name.
yarn install
- installs the dependenciesyarn start
- watch's.ts
files and compiles tobuild
folder then the server is reloaded atlocalhost:3000
yarn test
- runs the tests with jest (typescript
tests)yarn build
- compiles.ts
files tobuild
folderyarn serve
- starts the app (node build/bin/server.js
)yarn prettier
- runs prettier to prettify the code (also runs before each commit)
docker build -t myapi .
docker run -d -p 80:3000 myapi
Passing environment variables:
docker run -d -p 80:3000 -e "MYVAR=apikey" myapi
MIT