Middleware overhaul! (#18218)
* Middleware overhaul! - Remove unnecessary 'async' keywords from middleware functions - Ensure all middleware functions we create have names - Wrap the method contents of all async middleware functions in a try-catch+next(error) pattern * Use asyncMiddleware wrapper instead of try-catch+next(error) pattern * Remove unnecessary try-catch+next(error) pattern from context middleware
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const languageCodes = Object.keys(require('../lib/languages'))
|
||||
|
||||
// determine language code from first part of URL, or default to English
|
||||
module.exports = async function detectLanguage (req, res, next) {
|
||||
module.exports = function detectLanguage (req, res, next) {
|
||||
// /en/articles/foo
|
||||
// ^^
|
||||
const firstPartOfPath = req.path.split('/')[1]
|
||||
|
||||
Reference in New Issue
Block a user