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

284
Visualizações
When i use express and use ''use'' request to get response this came in my chorme bowser Cannot GET

iam new in node.js .iam faceing this problem .When i use express and use ''use'' request to get response to the chorome but this erro came in my chorme bowser Cannot GET. or my app.js file or index.js is in one same folder . folder name is static. Iam not good in english please help me. Or if i use nodemon togther than when i get to localhost the the loaclhost cannot and show this 'This site can’t be reached' i dont know how to fix it can any help me to fix this problem this the code

const express = require("express");
const app = express();
 const port = 8080;

app.use('/static',express.static('express/static'));

app.get("/", (req, res)=>{
    res.status(200).send("This is the first page of node express");
});

app.get("/about", (req, res)=>{
    res.send("This is the about page of node express");

});

app.post("/postabout", (req, res)=>{
    res.send("This is the postabout page of node express");

});

app.post("/erro", (req, res)=>{
    res.status(404).send("This page has been errored in code of 404");

});

app.listen(80,'127.0.0.1', () =>{
    console.log(`The application started and the port is ${port}`);
});
This the image of my code and chrome

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

In app.listen you passed wrong port means you intialized port as 8080 but passed 80

app.listen(8080,() =>{
    console.log(`The application started and the port is ${port}`);
});
about 4 years ago · Juan Pablo Isaza Relatório

0

Basically, app.use function uses a middleware when a particular API is called it does not a get request.

So try app.get instead of app.use it will work.

app.get('/static', (req, res) => {
  // Do your stuffs.
  return res.send(response)
})
about 4 years ago · Juan Pablo Isaza Relatório
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