koa-no-slash

1.0.2 • Public • Published

koa-no-slash

Koa middleware removing trailing slash from path.

Requirements

  • nodejs v14+
  • add type=module in your package.json as middleware is exported as ESM

Usage

Install:

yarn add koa-no-slash

Usage:

import http from 'http';
import koa from 'koa';
import noslash from 'koa-no-slash';

const app = new koa()
app.use(noslash());
app.use(ctx => ctx.body = ctx.path);

const server = http
    .createServer(app.callback())
    .listen(80, console.log);

Readme

Keywords

none

Package Sidebar

Install

npm i koa-no-slash

Weekly Downloads

118

Version

1.0.2

License

MIT

Unpacked Size

3.8 kB

Total Files

7

Last publish

Collaborators

  • damianobarbati