Template for quickly creating a production ready REST API, compliant to the OAS 3 protocol.
This template uses:
- winston for logging
- mongoose as MongoDB ORM
- JSON web token for authentication
- Socket.io for websocket communication.
- Swagger UI for the API documentation
For the development:
- Linting with eslint and Airbnb rule
- Mocha/chai/should for unit testing
When running, the API definition file is served on /api-docs.
Clone:
git clone https://github.com/niabb/express-openapi-mongoose-template.git newRepo
cd newRepo
git remote set-url origin https://github.com/userName/newRepo
git remote add upstream https://github.com/niabb/express-openapi-mongoose-template
git push origin master
git push --all
Keep up to date:
git pull upstream master
Create the configuration file: cp default.env .env
and edit it to match your environment.
Then start the app: npm run start
Run the app in development mode with nodemon: npm run watch
Run ESLint: npm run lint
Play unit tests:
# First, create the test .env file and fill it to match the test environment
cp default.env test/.env
npm run test