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://MyUserName:MyPassword@cluster0.hf6zp.mongodb.net/?retryWrites=true&w=majority';
const PORT = process.env.PORT || 5000;
mongoose.Promise = global.Promise;
mongoose.connect(CONNECTION_URL) .then(() => app.listen(PORT, () => console.log("Server running on port ${PORT}")) ).catch((error) => console.log(error.message));
//It is showing output on npm start
[nodemon] starting node index.js
bad auth : Authentication failed.
[nodemon] clean exit - waiting for changes before restart