Skip to content

Latest commit

 

History

History
95 lines (69 loc) · 2.3 KB

README.md

File metadata and controls

95 lines (69 loc) · 2.3 KB

boilerplate

express-server-kit

VERSION

LICENSE

AUTHOR

Express-Server Boilerplate

A boilerplate/starter project for quickly building RESTful APIs using Node.js, Express, and Mongoose.

By running a single command, you will get a production-ready Node.js app installed and fully configured on your machine.

Installation 🏭

$ npm install -g express-server-kit

Quick Start 🏃‍♂️

The quickest way to get started with express is to utilize the executable express-server to generate an application as shown below:

Create (and start) the app in current folder:

$ express-server .
$ npm run dev

OR, create (and start) the app (in project_name folder):

$ express-server project_name
$ cd project_name
$ npm run dev

This will basically create this structure in your folder

.....................................
├── .env
├── .gitignore
├── app.js
├── node_modules
|    └── ....
├── package-lock.json
├── package.json
├── routes
|    └── indexRoute.js
|    └── userRoutes.js
├── controllers
|    └── indexControllers.js
|    └── userControllers.js.js
├── models
|    └── userModels.js
├── views
|    └── index.html
.....................................

Environment Variables

The environment variables can be found and modified in the .env file. They come with these default values:

#port
PORT=4000

#mongodb uri
URI=mongodb://127.0.0.1:27017

#mongodb database
DB=my_database

What dependencies it installs ?

  • express - express framework
  • mongoose - Mongoose(MongoDB object modeling tool)
  • dotenv - for env variables
  • cors - enable CORS
  • http-errors - to create http errors
  • morgan - to log http requests
  • nodemon (dev) - monitors changes in files

Author ✍️

**Naqvi 🇩🇪 **

Contribute 🤝

You can fork this repo and send me a PR.