Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda