How to use the next-i18next/middleware function in next-i18next

To help you get started, weโ€™ve selected a few next-i18next examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pankod / next-boilerplate / server / index.ts View on Github external
app.prepare().then(() => {
    const server = express();

    app.setAssetPrefix(process.env.STATIC_PATH);
    server.use(express.static(path.join(__dirname, "../static")));
    server.use(nextI18NextMiddleware(nextI18next));

    if (process.env.PROXY_MODE === "local") {
        // eslint-disable-next-line global-require
        const proxyMiddleware = require("http-proxy-middleware");
        Object.keys(devProxy).forEach(context => {
            server.use(proxyMiddleware(context, devProxy[context]));
        });
    }

    server.get("*", (req, res) => handler(req, res));

    server.listen(port);

    // eslint-disable-next-line no-console
    console.log(
        `> Server listening at http://localhost:${port} as ${
github celo-org / celo-monorepo / packages / web / server / index.ts View on Github external
})

  server.get('/connect', (_, res) => {
    res.redirect('/community')
  })

  server.get('/tos', (_, res) => {
    res.redirect('/user-agreement')
  })

  server.get('/stake-off', (_, res) => {
    res.redirect('https://forum.celo.org/t/the-great-celo-stake-off-the-details/136')
  })

  server.use(bodyParser.json())
  server.use(nextI18NextMiddleware(nextI18next))

  server.post('/fellowship', async (req, res) => {
    const { ideas, email, name, bio, deliverables, resume } = req.body

    try {
      const fellow = await submitFellowApp({
        name,
        email,
        ideas,
        bio,
        deliverables,
        resume,
      })
      res.status(204).json({ id: fellow.id })
    } catch (e) {
      Sentry.withScope((scope) => {

next-i18next

The easiest way to translate your NextJs apps.

MIT
Latest version published 4 months ago

Package Health Score

87 / 100
Full package analysis