Express & ES6 API Boilerplate
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.
# 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=mongo://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 servernpm test
- Run test suitenpm run test:watch
- Run test suite with auto-reloadingnpm run coverage
- Generate test coveragenpm 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