# @t_rik/next-i18n-routes

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

Latest version **0.1.1** (published 2020-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @t_rik/next-i18n-routes
pnpm add @t_rik/next-i18n-routes
yarn add @t_rik/next-i18n-routes
bun add @t_rik/next-i18n-routes
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2020-03-22 |
| First published | 2020-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tomáš Uhrík |
| Maintainers | t_rik |

## Links

- npm: https://www.npmjs.com/package/@t_rik/next-i18n-routes
- npm.io page: https://npm.io/package/@t_rik/next-i18n-routes

## Dependencies (1)

- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^6.1.0

## Recent versions

- 0.1.1 (latest) — 2020-03-22
- 0.1.0 — 2020-03-22

## README

# Next-i18n-routes

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

## How to use
1. Prepare a custom server: https://nextjs.org/docs/advanced-features/custom-server
1. Prepare a your routes catalog in compliance with [Next-i18n-routes routing convention](./docs/ROUING_CONVENTION.md) 
1. Set up `NextI18nRoutesMiddleware` such as in the example below:
```
    const express = require("express");
    const next = require("next");
    const getNextI18nRoutesMiddleware = require("npm-ts-package-test").getNextI18nRoutesMiddleware;
    const routes = require('./routes').routes;

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

---
_Source: https://npm.io/package/@t_rik/next-i18n-routes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
