This is a starter Express.js1 API Template, helping to get past the routine of starting a new project from scratch again and again!
This template is still in WIP phase!
First install the dependencies:
npm i
Build the project. (Using TypeScript5)
npm run build
Watch for changes and rebuild automatically.
npm run build:watch
Test the project. (Using Jest6)
npm test
Test with code coverage report.
npm run test:coverage
Test in ci.
npm run test:ci
Check for code style issues in the project. (Using ESLint7)
npm run lint
Fix code style issues in the project.
npm run lint:fix
Generate the API documents to be served statically. (Using Swagger8)
npm run docs:swagger
Generate & serve the API documents. (The documents' server address will be printed in the terminal)
npm run docs:api
Generate the Code documents to be served statically. (Using TypeDoc9)
npm run docs:code
After running this command, open docs/code/index.html
in your preferred browser.
First create the .env
file:
cp .env.example .env
Name | Type | Default | Description |
---|---|---|---|
NODE_ENV |
production ,development ,test |
development |
Node.js3 environment (test will be provided by the testing framework automatically) |
RELEASE_ENV |
production ,staging |
staging |
Release environment |
Name | Type | Default | Description |
---|---|---|---|
SERVER_HOSTNAME |
string | localhost |
Express.js1 server hostname |
SERVER_PORT |
integer | 3000 |
Express.js1 server port |
Name | Type | Default | Description |
---|---|---|---|
DATABASE_URI |
string | - | MongoDB4 connection string uri |
Name | Type | Default | Description |
---|---|---|---|
SENTRY_DSN |
string | - | Sentry10 project DSN value |
Start the API.
npm start
Watch for changes and restart automatically.
npm run start:watch
Start the services:
docker-compose up -d --build --remove-orphans
Stop the services:
docker-compose down
.
├── __tests__ # Test files
│ ├── controllers # Express.js controller tests
│ └── jest # Test utilities
├── docs # Static documents
│ ├── api # API documents
│ └── code # Code documents
├── scripts # Project scripts
└── src # Source files
├── config # Configuration values
├── constants # Constants
├── controllers # Express.js controllers
├── lib # Libraries
└── models # Database models
We use SemVer11 for versioning. For the versions & changelogs available, see the releases on this repository.