/api-koa2-mongodb-starter

Starter for an API server using Koa2 and Mongoose (MongoDB server) with mock model + testing etc

Primary LanguageJavaScript

Api-Koa2-MongoDB-Starter

Quick Start

This starter works with npm or yarn.

Install:

yarn # or npm install

Run in dev mode, restarting the server on file changes:

yarn dev

# If you want to generate fresh tables
resetdb=true yarn dev

Run unit tests:

yarn test

Run in prod mode, not daemonized, with staging config (suitable for Heroku):

yarn build
yarn start

Start/stop in prod mode, daemonized, with local config:

yarn build
yarn local:start
yarn local:stop

Start/stop in prod mode, daemonized mode, with staging config:

yarn build
yarn staging:start
yarn staging:stop

Build (or update) the API documentation to api.html in the root:

yarn raml

Setup

Node.js (for local environment)

Download the latest stable version and install it on your machine: https://nodejs.org/en/download/

Verify it after the installation by running following commands.

$ node --version
$ npm --version

MongoDB (for local environment)

Follow the instructions from this blog post: https://scotch.io/tutorials/an-introduction-to-mongodb

Contributing

About Me

My name is Narain Sagar, I’m a FullStack JavaScript Developer, lives in Karachi, Pakistan and pretty much enjoying my life.

@narainsagar

Follow Me 👍

Medium | Website | Twitter | LinkedIn | Facebook | Github | Stack Overflow

License

MIT - Narain Sagar narainmenghwar@gmail.com