0

I am trying to execute the 'npm start' command in Visual Studio Code. However I am receiving an error as attached in the picture. Below is the code I am trying to run. Any tips on how I could get this running? I'm relatively new to Node and I am unable to follow where I am going wrong. Any help will be appreciated. Thanks in advance! PS: I have replaced the tag with my mongodb setup pw

[import express from 'express';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import cors from 'cors';

const app = express();

app.use(bodyParser.json({ limit : "30mb", extended: true }));
app.use(bodyParser.urlencoded({ limit : "30mb", extended: true }));
app.use(cors());

const CONNECTION_URL  = 'mongodb+srv://myuser_1:<password>w@cluster0.hhbz2.mongodb.net/myFirstDatabase?retryWrites=true&w=majority';
const PORT = process.env.PORT || 5000;
mongoose.connect(CONNECTION_URL, { useNewUrlParser: true, useUnifiedTopology: true })
     .then(() => app.listen(PORT, () => console.log(`Server running on port: ${PORT}`)))
     .catch((error) => console.log(error.message));

Node error msg

The error message is as follows: (I have uploaded image but not sure if it will be visible, hence posting the error I am facing)

PS D:\Memories_Project\server> npm start

> server@1.0.0 start D:\Memories_Project\server
> nodemon index.js

[nodemon] 2.0.13
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json  
[nodemon] starting `node index.js`
bad auth : Authentication failed.
[nodemon] clean exit - waiting for changes before restart
  • 1
    Thank you for the link. A minor typo in my password. I think the frustration got to me and I overlooked it. This was really helpful. – Shilpa S Sep 25 '21 at 07:07

0 Answers0