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

254
Views
Says that username/password entered is empty even though it isn't

I am making an app and right now I am coding the backend with express js in node js. For some reason, It is saying that the username and password is invalid.

Backend testing

app.get("/signUp", async (req, res) => {
const json = req.body;
const user = await UserModel.findOne(json["username"])
if(!json["username"] || json["username"] === "" || !json["password"] || json["password"] === "") {
    return res.status(400).send({
        "status": 400,
        "message": "Username and/or password is empty. New user was not created"
    })
}
else if(user.type != null) {
    return res.status(409).send({
        "status": 409,
        "message": "User already exists with given username. New user was not created."
    })
}
else {
    await UserModel.create({
        username: json["username"],
        password: json["password"] 
    })
    return res.status(200).send({
        "status": 200,
        "message": "New user was created."
    })
}

})

about 4 years ago · Juan Pablo Isaza
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!