Answer the question
In order to leave comments, you need to log in
How to execute two requests in a row?
I have validation functions. I moved them into separate functions and call them in route handlers.
// CHECK VALID URL
const checkValidUrl = async (req, res) => {}
// CHECK RIGHTS
const checkRights = async (req, res) => { }
// CHECK URL
router.post('/url', async(req, res) => checkValidUrl(req, res));
// CHECK RIGHTS
router.post('/rights', async (req, res) => checkRights(req, res));
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
Answer the question
In order to leave comments, you need to log in
As far as I know, only one response is possible for one post coming from a client. Both should be included in the same answer.
Apparently you have an error somewhere in the code of the handler functions, show what is there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question