Socket
Book a DemoInstallSign in
Socket

@trisbee/next-i18n-routes-middleware

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trisbee/next-i18n-routes-middleware

A middleware (+ utility tools) for having fully internationalized routes in your Next.js apps.

latest
Source
npmnpm
Version
2.1.0
Version published
Maintainers
3
Created
Source

next-i18n-routes-middleware

A middleware (+ utility tools) for having fully internationalized routes in your Next.js apps.

How to use

  • Install this dependency: npm i @trisbee/next-i18n-routes-middleware
  • Prepare a custom server
  • Prepare a your routes catalog in compliance with Next-i18n-routes routing convention
  • Set up NextI18nRoutesMiddleware such as in the example below:
    const express = require("express");
    const next = require("next");
    const getNextI18nRoutesMiddleware = require("@trisbee/next-i18n-routes-middleware").getNextI18nRoutesMiddleware;
    const routes = require('./routes').routes;

    const app = next({ isInDevMode });
    
    app.prepare().then(() => {
      const server = express();
      
      server.use(
        getNextI18nRoutesMiddleware(
            server,
            app,
            { 
                supportedLangs: ['en', 'de', 'cs'],
                routes: routes,
                shouldHandleEmptyRoute: true
            }
        )
      );
    
      server.listen(process.env.PORT || 3000);
    });

Keywords

next

FAQs

Package last updated on 21 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts