Answer the question
In order to leave comments, you need to log in
How to avoid Cannot set headers after they are sent to the client error?
router.get('/', async (req, res, next) => {
const token = req.query.token;
if (!token) {
res.json({
status: 'error',
message: 'Не передан токен авторизации',
});
}
res.json({
status: 'ok',
message: `Токен: ${token}`,
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question