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

134
Visualizações
API function doesn't run

I have following api function:

    value = req.body;
    initalBoardID = value.model.id;
    value = value.action;
    type = value.type;
    translationKey = value.display.translationKey;
    res.status(200).json("Okay");
   if (
      type == "addMemberToCard" &&
      translationKey == "action_member_joined_card"
    ) {
      member = value.display.entities.memberCreator.id;
      createCard();
    }
  } else {
    res.status(200).json("Function works");
  }

When I send a POST request to the above function I get the status 200 but the code doesn't continue.

I have also an api function to get some inforamtion and errors.

When I call this function the code continues. But I don't call any function to log a information or an error of this api.

Do you know why the code doesn't continue from the beginning? Only when I call another api which does not log any information and errors?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If I read things correctly, if you send res.status or res.json, you can't send another response. Also if you send response, the code breaks, so it doesn't go far more, so as you have res.status etc. and then createCard() won't run because the function stops after sending response...

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