项目作者: kylealwyn

项目描述 :
ES6 Node Rest API boilerplate with Mongo Datastore
高级语言: JavaScript
项目地址: git://github.com/kylealwyn/node-rest-api-boilerplate.git
创建时间: 2016-10-24T23:44:42Z
项目社区:https://github.com/kylealwyn/node-rest-api-boilerplate

开源协议:MIT License

下载


Express & ES6 API Boilerplate

Build Status

Tested on Node v6 and above

Features

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

Getting Started

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

  1. # clone it
  2. git clone git@github.com:kylealwyn/node-rest-api-boilerplate.git
  3. cd node-rest-api-boilerplate
  4. # Make it your own
  5. rm -rf .git && git init
  6. # Install dependencies
  7. npm install
  8. # Run it
  9. npm start
  10. # Try it!
  11. curl -H "Content-Type: application/json" -X POST -d '{"username":"jamesdean", "email": "example@gmail.com", "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:

  1. MONGO_URI=mongodb://somewhere:27017
  2. 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