My own NodeJS REST starter files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Roger Gonzalez 0865e83aa2
Merge pull request #13 from programma-group/develop
11 months ago
.circleci Fixed CircleCI command 1 year ago
src Made changes to match prettier standards 11 months ago
test Made changes to match prettier standards 11 months ago
.env.example Changed variables.env.example to .env.example for standards 1 year ago
.eslintrc.json Installed and configured prettier 11 months ago
.gitignore Added User model and a script to create a user 1 year ago
.nycrc Added CodeClimate 1 year ago
.prettierrc Installed and configured prettier 11 months ago
LICENSE Initial commit 1 year ago
README.md Added extra line break between badges and text 1 year ago
package-lock.json Installed and configured prettier 11 months ago
package.json Installed and configured prettier 11 months ago

README.md

Programma Group REST MongoDB starter files

Status: CircleCI Maintainability Test Coverage

Comes with:

  • ES6 support.
  • Mongoose ORM.
  • API documentation using Swagger.
  • ESLint for code linting.
  • Configuration management using dotenv.
  • Logging of requests with Winston.
  • Tests using Mocha/Chai.
  • Coverage report through nyc. ---

Prerequisites

Setup

Clone the repository, install the dependencies and get started right away.

$ git clone git@github.com:programma-group/starter-mongo.git <application-name>
$ cd <application-name>
$ rm -rf .git
$ npm install

Make a copy of .env.example as .env and update your application details and database credentials.

Environment variables description

  • NODE_ENV: The node environment
  • DATABASE= Mongo Database URL.
  • TEST_DATABASE: Test Mongo Database URL.
  • PORT: Application port. If not specified, it defaults to port 7777.
  • TEST_PORT: Port to run tests.
  • MAIL_HOST: Host used by nodemailer when it sends an email
  • MAIL_PORT: Port used by nodemailer when it sends an email
  • MAIL_USER: User used by nodemailer when it sends an email
  • MAIL_PASSWORD: Password used by nodemailer when it sends an email
  • SECRET: Secret key used to encrypt JWT tokens
  • URL: The server’s URL. Used by swagger docs explorer

This in an example of a .env file

NODE_ENV=development
DATABASE=mongodb://user:pass@host.com:port/database
TEST_DATABASE=mongodb://user:pass@host.com:port/database-test
PORT=7777
TEST_PORT=3333
MAIL_HOST=my.host.com
MAIL_PORT=2525
MAIL_USER=myuser
MAIL_PASSWORD=mypassword
SECRET=mysecret
URL=localhost

Starting the application

$ npm run start

Navigate to http://localhost:7777/docs/ to verify the instalation.

Tests

If you have set the test database on the .env file, you can run the tests by using

$ npm run test

Contributing

For contribution and feature requests, please create an issue first.

License

starter-mongo is under MIT License.