Node + Stripe + Express
This is a template for you to use on your own projects for processing one-time Stripe charges. Follow the directions below to get started.
Looking for a simple example? Node Stripe Example
The back-end API includes:
- User auth
- Stripe integration
- Testing via Mocha and Chai as well as Istanbul for code coverage
Quick Start
- Clone and install dependencies
- Update the config:
- Rename the .env_sample file to .env and update
- Update the Mongo URI in /src/_config.js (if necessary)
- Update the key on line 1 of src/client/js/main.js
- Run
mongod
in a seperate terminal window - Run the app -
npm start
orgulp
The database, if empty, is seeded with an admin user - username: [email protected] / password: admin
Development Workflow
- Create feature branch
- Develop/test locally (hack! hack! hack!)
- Create PR, which triggers Travis CI
- After tests pass, merge the PR
- Tests run again on Travis CI
- Once tests pass, code is deployed automatically to staging server on Heroku (WIP)
Tests
Without code coverage:
$ npm test
With code coverage:
$ npm run cov
Changelog
- 02/09/2016 - refactored passport, tests, error handlers, client-side javascript (view commit)
- 04/23/2015 - major refactor
- 03/11/2015 - updated to Express 4.x
JSON API Documentation
Admin required for all routes!
Users
- GET
/api/v1/users
- get all users - GET
/api/v1/users/:id
- get user - POST
/api/v1/users
- create user - PUT
/api/v1/users/:id
- update user - DELETE
/api/v1/users/:id
- delete user
Products
- GET
/products
- get all products - GET
/products/:id
- get products - POST
/products
- create products - PUT
/products/:id
- update products - DELETE
/products/:id
- delete products
Store
- GET
/stores
- get all stores - GET
/store/:id
- get store - POST
/stores
- create store - PUT
/store/:id
- update store - DELETE
/store/:id
- delete store (need to test)
Plan (todo)
- GET
/plans
- get all plans - GET
/plan/:id
- get plan - POST
/plans
- create plan - PUT
/plan/:id
- update plan - DELETE
/plan/:id
- delete plan