/Node-Backend-Seed

A nice starting point for a restful JSON API that includes: Express.js, Mongoose.js, token based authentication, and a portable environment using Vagrant/Docker/Compose.

Primary LanguageJavaScriptMIT LicenseMIT

A nice starting point for a restful JSON API that includes:

Getting Started

Before getting started, make sure you have Vagrant installed.

  • Clone this repo: git clone https://github.com/projectweekend/Node-Backend-Seed.git New-Name
  • Change directory: cd New-Name
  • Launch the Vagrant VM: vagrant up
  • SSH into the VM: vagrant ssh
  • Change directory into the project root: cd /vagrant
  • Launch the API app and database containers: docker-compose up

Getting Started Notes

  • The first time you issue the vagrant up commmand the base box for the VM will be downloaded and provisioned automatically according to the project's Vagrantfile. This may take a little while to complete depending on the speed of your network connection. Subsequent launches using vagrant up will run much faster. For more information about other Vagrant commands, check out the documentation.
  • The first time you issue the docker-compose up command the base NodeJS and MongoDB containers will be downloaded from the Docker Registry, according to the project's docker-compose.yml and Dockerfile. This may take a little while to complete depending on the speed of your network connection. Subsequent launches using docker-compose up will run much faster. For more information about Docker Compose, check out the documentation.

Project Organization Notes

  • Use the /routes/index.js file for mapping route handler functions to URLs. This helps keep app.js from getting cluttered.
  • Route handlers, and all the supporting items they require, are defined in /api.
  • Mongoose models related to each handler module are managed in /api/module_name/models.js
  • Simple authentication and signup routes are already active in the seed application. These exist as part of the /api/user module.