Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

261
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda