Closed golubvladimir closed 4 years ago
My config
const i18next = require('i18next'); const i18nextMiddleware = require('i18next-express-middleware'); const FilesystemBackend = require('i18next-node-fs-backend'); const { Router } = require('express'); // init middleware for initialization i18next .use(i18nextMiddleware) .use(FilesystemBackend) .init({ preload: ['en', 'ru'] }, function () { i18nextMiddleware.addRoute( i18next, ':lng/test', Router, 'get', (req, res) => { res.json({status: 'ok'}); } ) }); const app = express(); app.use(i18nextMiddleware.handle(i18next));
Error:C:...\adminpanel\node_modules\i18next-express-middleware\lib\index.js:185 app[verb || 'get'].apply(app, routes.concat(callbacks)); ^ TypeError: Cannot read property 'apply' of undefined
pass in app not Router https://github.com/i18next/i18next-express-middleware#add-localized-routes
app
My config
Error:C:...\adminpanel\node_modules\i18next-express-middleware\lib\index.js:185 app[verb || 'get'].apply(app, routes.concat(callbacks)); ^ TypeError: Cannot read property 'apply' of undefined