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

98
Visualizações
express req.body returns value then returns undefined

so basically, i'm using this code:

app.post("/settings/update/:id/:category", async (req, res) => {
    let category = req.params.category;

    if (category == "goodbye") {
        var goodbye_message = req.body.goodbyeMessage;

        await vibes.db.setServerVar(
            "main",
            "leave_message",
            req.params.id,
            goodbye_message
        );

        var goodbye_channel = req.body.goodbyeChannel;

        console.log(goodbye_message, goodbye_channel)

        await vibes.db.setServerVar(
            "main",
            "leave_channel",
            req.params.id,
            goodbye_channel
        );
    }

    res.status(204).send();
});

and, when i submit my form, it returns the actual value that i use on my ejs files, but then it also returns undefined when i want to log it, like when i submit, it logs this in console:

undefined undefined

then it logs

test! 914519440576638997

so it basically logs as undefined, but then logs my value, how do i get rid of the undefined? because it makes my code not work proprely!

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