node-rest-api-boilerplate

ES6 Node Rest API boilerplate with Mongo Datastore

2 years after

Express & ES6 API Boilerplate

Build Status

Tested on Node v6 and above

Features

  • [x] ES6 for the latest & greatest javascript awesomeness
  • [x] MongoDB w/ Mongoose for data layer
  • [x] Testing via Mocha & Chai
  • [x] Test coverage via Isparta
  • [x] Username/Email registration and authentication

Getting Started

First, ensure you have node and mongo installed on your system.

# clone it
git clone [email protected]:kylealwyn/node-rest-api-boilerplate.git
cd node-rest-api-boilerplate

# Make it your own
rm -rf .git && git init

# Install dependencies
npm install

# Run it
npm start

# Try it!
curl -H "Content-Type: application/json" -X POST -d '{"username":"jamesdean", "email": "[email protected]", "password":"password1"}' http://localhost:4567/users

Environment Variables

Place a .env file in the top level of the directory you've cloned. These variables will be automatically assigned to process.env when the application boots. It is gitignored by default as it's not good practice to store your environment variables in your remote repository. Your .env file can look something like this:

MONGO_URI=mongodb://somewhere:27017
SESSION_SECRET=lolthisissecret

Now we can access one of these variables with something like process.env.MONGO_URI!

NPM Scripts

  • npm start - Start live-reloading development server
  • npm test - Run test suite
  • npm run test:watch - Run test suite with auto-reloading
  • npm run coverage - Generate test coverage
  • npm run build - Generate production ready application in ./build

Todo

  • [ ] Add OAuth Login Support (Facebook, Twitter, Google)
  • [ ] Add support for MySql or PostgreSQL (Possibly with sequelize)
  • [ ] Reset password functionality

License

MIT

Related Repositories

react-static-boilerplate

react-static-boilerplate

Boilerplate and tooling for web application development based on React (ReactJS) ...

express-mongoose-es6-rest-api

express-mongoose-es6-rest-api

:collision: A boilerplate application for building RESTful APIs Microservice in ...

express-es6-rest-api

express-es6-rest-api

:battery: Starter project for an ES6 RESTful Express API. ...

javascript-boilerplate

javascript-boilerplate

Node.js+Koa.js+PostgreSQL+React.js+Webpack+Mocha+Makefile, a starter kit for new ...

snippod-boilerplate

snippod-boilerplate

webapp + server full stack architecture boilerplate using "react+reflux"(front) ...