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

119
Views
server cannot handle requests

client_side:

    <script>
        const name = localStorage['name']
        async function getUsers() {
            const page = document.querySelector('.page')
            const res = await fetch('http://localhost:3000/users')
            for(const name in res.usersName) {
                let userDiv = document.createElement('div')
                userDiv.innerHTML = name
                userDiv.style.textAlign = "center"
                page.append(div)
            }
        }
        getUsers()
    </script>
    </script>

server_side:

    const express = require('express')
    const app = express()
    const server = createServer(app).listen(3000)
    /*
    BODY: all of the routs 
    */
    /*this is where I get the error when I try to make a GET request to this rout
      it sends me 404 status error
    */
    app.get('users', (req, res) => {
     const usersName = new Array()
     console.log(req)
     for(const user of users) {
        usersName.push(user.name)
     }
     res.json({ usersName })
    })

when I make a GET request to API/users route I get this error message in the client_side console:

home:27 GET http://localhost:3000/users 404 (Not Found)

and I don't know why can anyone help

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you forgot to put / before `users'.

app.get('/users', (req, res)=>{
    //your code block here
})
about 4 years ago · Juan Pablo Isaza 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!