Giter Site home page Giter Site logo

node-rest-api-boilerplate's Introduction

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.

# 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

node-rest-api-boilerplate's People

Contributors

kylealwyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-rest-api-boilerplate's Issues

Thank you

This package is brilliant. Great boilerplate using es6 with just the right amount of packages to get going.

Just wanted to say thanks for putting in the time to create it and then share it!

crashed when pushing to heroku

I'm sure it's something silly, but when I try to push this to heroku i get an app crashed with this error. Could this have something to do with the .env file?

2017-09-03T17:43:47.650933+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-03T17:43:50.252528+00:00 heroku[web.1]: Starting process with command `npm start`
2017-09-03T17:43:53.249601+00:00 app[web.1]: 
2017-09-03T17:43:53.249619+00:00 app[web.1]: > [email protected] start /app
2017-09-03T17:43:53.249620+00:00 app[web.1]: > node
2017-09-03T17:43:53.249620+00:00 app[web.1]: 
2017-09-03T17:43:53.768542+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-03T17:43:53.757113+00:00 heroku[web.1]: Process exited with status 0
2017-09-03T17:43:55.336112+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=tranquil-mountain-51560.herokuapp.com request_id=b0188ff3-83d8-4e83-8abf-4b833061c29b fwd="71.184.137.140" dyno= connect= service= status=503 bytes= protocol=https
2017-09-03T17:43:55.417208+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=tranquil-mountain-51560.herokuapp.com request_id=47bbbd36-656f-44cc-a50f-30fa135ccdb4 fwd="71.184.137.140" dyno= connect= service= status=503 bytes= protocol=https
2017-09-03T17:43:55.702863+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=tranquil-mountain-51560.herokuapp.com request_id=5c88b619-6170-40cb-95d4-9c2b2330996a fwd="71.184.137.140" dyno= connect= service= status=503 bytes= protocol=https
2017-09-03T17:43:58.398308+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=tranquil-mountain-51560.herokuapp.com request_id=fd56c026-6381-4473-a744-1a4f02c3656c fwd="71.184.137.140" dyno= connect= service= status=503 bytes= protocol=https
 Autoscroll with output Save
heroku.com Blogs Careers Documentation
Support

NPM run build

This command doesn't copy some folder like public etc to the dist folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.