Home > Net >  How to run Node.js project connected with MongoDB, { downloaded from GitHub } in my pc
How to run Node.js project connected with MongoDB, { downloaded from GitHub } in my pc

Time:11-04

I want to know how to run Node.js project connected with MongoDB, { downloaded from GitHub } in my pc

Project link this is the error iam getting, after running npm install, run and start

I want to run this project in my laptop

CodePudding user response:

As the readme file suggested you first have to create a .env file, then proceed by adding the two required values in your env file:

MONGO_URI=your mongo db URI goes here
JWT_SECRET=your JWT Secret token goes here

then run npm i to install all the required packages and npm start to run the project

CodePudding user response:

This project uses the dotenv

https://github.com/john-smilga/node-express-course/blob/dc0635c55bf27ef77a8aeddf3570892480f2c899/06-jobs-api/final/app.js#L55

You can see that the code reads some variable values from a .env file. This file is not pushed usually for security issues.

create a file named .env at the root of your project. Add two variables:

MONGO_URI = mongodb://localhost:27017
JWT_SECRET = <your JWT secret token>

Then run again the server again : npm start

  • Related