I am trying to build a node.js API using Express.js and MongoDB I have called the libraries and MongoDB, also I have set a port and MongoDB connection.
When I execute the command npm start
. The server starts but it still gives an error.
const express = require('express');
const app = express();
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/subscribers', {useNewUrlParser: true, useUnifiedTopology: true})
.then(() => console.log('MongoDB Connected...'))
.catch((err) => console.log(err))
app.listen(3000, () => console.log('server started'));