All Projects → maitraysuthar → Rest Api Nodejs Mongodb

maitraysuthar / Rest Api Nodejs Mongodb

Licence: mit
A boilerplate for REST API Development with Node.js, Express, and MongoDB

Programming Languages

javascript
184084 projects - #8 most used programming language
es6
455 projects

Projects that are alternatives of or similar to Rest Api Nodejs Mongodb

Node Express Mongoose Passport Jwt Rest Api Auth
Node, express, mongoose, passport and JWT REST API authentication example
Stars: ✭ 146 (-78.27%)
Mutual labels:  api, rest-api, rest, express, expressjs, jwt-authentication
Express Boilerplate
🚀 Starter project for a RESTful API in Node with Express & mongoose component-based
Stars: ✭ 9 (-98.66%)
Mutual labels:  rest-api, mongodb, express, jwt-authentication, boilerplate
Node Express Mongodb Jwt Rest Api Skeleton
This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API). Demo of frontend in VueJS here: https://github.com/davellanedam/vue-skeleton-mvp
Stars: ✭ 603 (-10.27%)
Mutual labels:  api, rest, mongodb, express, jwt-authentication
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-77.23%)
Mutual labels:  api, mongodb, express, jwt-authentication, boilerplate
Bookmarks.dev
Bookmarks and Code Snippets Manager for Developers & Co
Stars: ✭ 218 (-67.56%)
Mutual labels:  api, rest-api, rest, mongodb, expressjs
Node Rem
Node REM - NodeJS Rest Express MongoDB and more: typescript, passport, JWT, socket.io, HTTPS, HTTP2, async/await, nodemailer, templates, pagination, docker, etc. Live Demo: https://node-rem-ngduc.vercel.app
Stars: ✭ 192 (-71.43%)
Mutual labels:  rest-api, mongodb, express, boilerplate
Rest Hapi
🚀 A RESTful API generator for Node.js
Stars: ✭ 1,102 (+63.99%)
Mutual labels:  api, rest-api, rest, mongodb
Tiledesk Server
Tiledesk server. Tiledesk is an Open Source Live Chat platform written in NodeJs and MongoDB
Stars: ✭ 94 (-86.01%)
Mutual labels:  api, rest-api, rest, mongodb
React With Wordpress
🔥 Example of react application to access WordPress REST API
Stars: ✭ 137 (-79.61%)
Mutual labels:  api, rest-api, express, jwt-authentication
Laravel Api Boilerplate
A Boilerplate Project For Laravel API's (NOT MAINTAINED)
Stars: ✭ 113 (-83.18%)
Mutual labels:  api, rest-api, jwt-authentication, boilerplate
Practicalnode
Practical Node.js, 1st and 2nd Editions [Apress] 📓
Stars: ✭ 3,694 (+449.7%)
Mutual labels:  rest-api, mongodb, express, expressjs
Koa Restful Boilerplate
Koa 2 RESTful API boilerplate
Stars: ✭ 146 (-78.27%)
Mutual labels:  rest-api, rest, mongodb, boilerplate
Rest
REST API generator with Node.js, Express and Mongoose
Stars: ✭ 1,663 (+147.47%)
Mutual labels:  rest-api, rest, mongodb, boilerplate
Cookiecutter Django Rest
Build best practiced apis fast with Python3
Stars: ✭ 1,108 (+64.88%)
Mutual labels:  api, rest-api, rest, boilerplate
Express Rest Boilerplate
⌛️ Express starter for building RESTful APIs
Stars: ✭ 1,794 (+166.96%)
Mutual labels:  rest-api, mongodb, express, boilerplate
Node Express Postgresql Sequelize
Node.js, Express.js, Sequelize.js and PostgreSQL RESTful API
Stars: ✭ 148 (-77.98%)
Mutual labels:  api, rest, express, expressjs
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (-77.38%)
Mutual labels:  api, rest-api, rest, mongodb
Mevn Stack
A Quickstart for building an Express API with a VueJS Admin Portal
Stars: ✭ 178 (-73.51%)
Mutual labels:  mongodb, express, expressjs, boilerplate
Node Express Boilerplate
A boilerplate for building production-ready RESTful APIs using Node.js, Express, and Mongoose
Stars: ✭ 890 (+32.44%)
Mutual labels:  rest-api, mongodb, express, boilerplate
Nodejs Restful Api
How to create a RESTful CRUD API using Nodejs?
Stars: ✭ 285 (-57.59%)
Mutual labels:  api, rest, mongodb, express

Nodejs Expressjs MongoDB Ready-to-use API Project Structure

Author GitHub license GitHub repo size Codacy Badge Codacy Badge Travis (.com)

A ready-to-use boilerplate for REST API Development with Node.js, Express, and MongoDB

Getting started

This is a basic API skeleton written in JavaScript ES2015. Very useful to building a RESTful web APIs for your front-end platforms like Android, iOS or JavaScript frameworks (Angular, Reactjs, etc).

This project will run on NodeJs using MongoDB as database. I had tried to maintain the code structure easy as any beginner can also adopt the flow and start building an API. Project is open for suggestions, Bug reports and pull requests.

Advertise for Job/Work Contract

I am open for a good job or work contract. You can contact me directly on my email ([email protected]) or you can download my CV from my personal website.

Buy me a Coffee

If you consider my project as helpful stuff, You can appreciate me or my hard work and time spent to create this helpful structure with buying me a coffee.

Buy Me A Coffee

Features

  • Basic Authentication (Register/Login with hashed password)
  • Account confirmation with 4 (Changeable) digit OTP.
  • Email helper ready just import and use.
  • JWT Tokens, make requests with a token after login with Authorization header with value Bearer yourToken where yourToken will be returned in Login response.
  • Pre-defined response structures with proper status codes.
  • Included CORS.
  • Book example with CRUD operations.
  • Validations added.
  • Included API collection for Postman.
  • Light-weight project.
  • Test cases with Mocha and Chai.
  • Code coverage with Istanbuljs (nyc).
  • Included CI (Continuous Integration) with Travis CI.
  • Linting with Eslint.

Software Requirements

  • Node.js 8+
  • MongoDB 3.6+ (Recommended 4+)

How to install

Using Git (recommended)

  1. Clone the project from github. Change "myproject" to your project name.
git clone https://github.com/maitraysuthar/rest-api-nodejs-mongodb.git ./myproject

Using manual download ZIP

  1. Download repository
  2. Uncompress to your desired directory

Install npm dependencies after installing (Git or manual download)

cd myproject
npm install

Setting up environments

  1. You will find a file named .env.example on root directory of project.
  2. Create a new file by copying and pasting the file and then renaming it to just .env
    cp .env.example .env
    
  3. The file .env is already ignored, so you never commit your credentials.
  4. Change the values of the file to your environment. Helpful comments added to .env.example file to understand the constants.

Project structure

.
├── app.js
├── package.json
├── bin
│   └── www
├── controllers
│   ├── AuthController.js
│   └── BookController.js
├── models
│   ├── BookModel.js
│   └── UserModel.js
├── routes
│   ├── api.js
│   ├── auth.js
│   └── book.js
├── middlewares
│   ├── jwt.js
├── helpers
│   ├── apiResponse.js
│   ├── constants.js
│   ├── mailer.js
│   └── utility.js
├── test
│   ├── testConfig.js
│   ├── auth.js
│   └── book.js
└── public
    ├── index.html
    └── stylesheets
        └── style.css

How to run

Running API server locally

npm run dev

You will know server is running by checking the output of the command npm run dev

Connected to mongodb:YOUR_DB_CONNECTION_STRING
App is running ...

Press CTRL + C to stop the process.

Note: YOUR_DB_CONNECTION_STRING will be your MongoDB connection string.

Creating new models

If you need to add more models to the project just create a new file in /models/ and use them in the controllers.

Creating new routes

If you need to add more routes to the project just create a new file in /routes/ and add it in /routes/api.js it will be loaded dynamically.

Creating new controllers

If you need to add more controllers to the project just create a new file in /controllers/ and use them in the routes.

Tests

Running Test Cases

npm test

You can set custom command for test at package.json file inside scripts property. You can also change timeout for each assertion with --timeout parameter of mocha command.

Creating new tests

If you need to add more test cases to the project just create a new file in /test/ and run the command.

ESLint

Running Eslint

npm run lint

You can set custom rules for eslint in .eslintrc.json file, Added at project root.

Bugs or improvements

Every project needs improvements, Feel free to report any bugs or improvements. Pull requests are always welcome.

License

This project is open-sourced software licensed under the MIT License. See the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].