Linked Questions

Popular Questions

Server running on port: [object Object]

Asked by At

Im learning how to create backend stuff, but when I run nodemon I get that "server running on port [object Object]" and i am uncertain on what to do.

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 = '*****my_mongodb_database*****';
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));

result: Server running on port [object Object]

I was expecting Server running on port: 5000

Related Questions