const express = require('express');
const mongoose = require('mongoose');
const route = require('./routes/todoroute');
const cors = require('cors');
require ('dotenv').config();
const app = express();
const PORT = process.env.port || 3000;
app.use(express.json());
app.use(cors());
app.use(express);
mongoose.connect(process.env.MONGODB_URL)
.then(()=>{
console.log('DB connected');
})
.catch((err)=>{
console.log(err);
})
app.use(route);
app.listen (PORT, ()=>{
console.log(`Server is running on port ${PORT}`);
})
local host was working fine an hour ago but now first it showed my Cannot get erorr and now this
it is the server.js file of my todo app backend
if you want i can provide other code snippets too !