The API is powered by Express.js. This Template can be used to setup a new nodejs backend project. The database is used is MongoDB Atlas.
The template contains a scalable code structure for a NodeJs based backend enabling easy to use and maintain project structure.
Table of Contents
Below is the list of all the major frameworks and libraries used in the project.
To get a local copy of the API Server up and running follow these simple steps
- Clone the repository
git clone https://github.com/himakhaitan/nodejs_expressjs_template.git
- Install the dependencies
npm install
-
Follow the Installation Steps
-
Ready to run the Server
npm run start
- For Development Mode
npm run dev
This will constantly look for changes in your code and restart the server automatically. Rescued Huhh!
The prerequisites for the API server to run are the following:
- Node.js (v16.16.0 or higher)
- MongoDB (Locally or Cloud)
- and you are good to go!
Following are the steps to configure the API Server and make it up and running.
- Configure the Environment Variables
- Create a file called
.env
in the root directory of the project - Add the following lines to the file
DATABASE_URL=MONGODB_URL TOKEN_SECRET=PORT_TO_RUN_YOUR_SERVER
- Replace
DATABASE_URL
with a MongoDB Url (Locally Hosted or Cloud Based) - Replace
PORT
with a port number of your choice. - Note: You can also use the
sample.env
file to get a template of the file
- Create a file called
Feel free to reach me out on any of the above mediums (LinkedIn, Mail and Twitter for fast responses). See you in my inbox / DMs 📩 😃
Hapilly turning Coffee into Code ☕️ 💻