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

129
Views
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 answers
Answer question

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 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!