skip to Main Content

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

Project link https://github.com/john-smilga/node-express-course/tree/main/06-jobs-api/final

In its read me file it has been written that

#### Project Setup

In order to spin up the project, in the root create .env with these two variables, with your own values.

MONGO_URI
JWT_SECRET

After that run this command

```bash
npm install && npm start
```

I have installed MongoDB community version, but need help in setting up and run this projectthis is the error iam getting, after running npm install, run and start

I want to run this project in my laptop

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search