Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

168
Vistas
Express server is not connected Kindly help me

I am learning mern stack and was watching a tutorial on youtube code camp.org. I followed along with tutor code but his code is working and mines not working. my express server is not connected or something. I started nodemon server.js

[nodemon] 2.0.19 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: js,mjs,json [nodemon] starting node server.js [nodemon] clean exit - waiting for changes before restart

but i am not getting the console message which i should get if i am connected to express server.

this is my index.js file

import app from '../server'
import mongodb from "mongodb";
import dotenv from "dotenv";
dotenv.config();

const MongoClient = mongodb.MongoClient;

const port = process.env.PORT || 8000;

MongoClient.connect(process.env.RESTREVIEWS_DB_URI, {
  poolSize: 50,
  wtimeout: 2500,
  useNewUrlParse: true,
}).catch(err => {
  console.error(err.stack)
  process.exit(1)
})
.then(async client => {
    app.listen(port, ()=>{
        console.log(`listening on  ${port}`)
    })
})

and in case you need this is my server.js file

import express from "express"
import cors from "cors"
import restaurants from "./api/restaurants.route.js"

const app = express()

app.use(cors())
app.use(express.json())

app.use("/api/v1/restaurants",restaurants)
app.use("*", (req,res)=>res.status(404).json({error: "not found"}))


export default app

my specified port is 5000

kindly i am a beginner guide me what should i do

thank you!

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda