V
V
Vladimir Golub2020-01-30 14:10:42
Node.js
Vladimir Golub, 2020-01-30 14:10:42

Do I need to specify async for the route if the controller has an async function?

Do I need to specify async for the route if the controller has an async function?

// routes.js
const localesController = require('../controllers/locales');
locales.get('/', localesController.getLocales);

// getLocales
module.exports = async (req, res) => {

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2020-01-30
@vshvydky

express is waiting for a synchronous function with a synchronous error, so it doesn't matter how you specify it...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question