Basic Node.js Express backend API, with MongoDB database.
-
Prerequisites: You need to have Git, Node/npm and MongoDB installed on your computer
-
Clone the repo
-
Install npm dependencies (
package.json
)
npm install
- Run MongoDB in the background (in another terminal)
sudo service mongod start
- Run the server. It will be available at
http://localhost:3000
npm run start
- Node.js (v8) + Express (v4) + Mongoose (v5)
- MongoDB database
- Tests with Mocha & Chai
- Linting with ESLint (Airbnb Style Guide + some custom rules)
Users
GET /api/users
POST /api/users
GET /api/users/:user_id
PUT /api/users/:user_id
DELETE /api/users/:user_id
Transactions
GET /api/transactions
POST /api/transactions
GET /api/transactions/:transaction_id
User Transactions
GET /api/users/:user_id/transactions
Tip: you can interact with the API with a tool like Postman
node db/seed.js
npm run test
npm run lint
- Authentication
- Unit Tests
- Use Mockgoose for tests (in-memory database)
- REPL to interact with the database using the models