Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
why is localhost:5000 denied in Express.js?

I am following a youtube tutorial:https://www.youtube.com/watch?v=ngc9gnGgUdA&t=1125s. In 18:25. "THIS WORK!" should be printed out on the localhost:5000 page, but I am not able to see it. Anyone can help?

enter image description here

enter image description here

enter image description here

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

From what I can see (as part of the first image is cut off), the problem is probably that you forgot call app.listen, which tells express to listen on port 5000.

app.listen(process.env.PORT, () => {
  // callback when server is up
})
about 4 years ago · Santiago Trujillo Report

0

It could be a CORS issue. Please try this

app.use(cors({
    origin: '*',
}));

That is because the same origin will always be allowed. If you need to allow requests from everywhere, that should be manually configurated. The code above basically will set the header Access-Control-Allow-Origin: * to do so.

This article explains in-depth about this. Even if it happens to be not applicable here, it's worth reading.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!