koa-no-slash
v1.0.2
Published
Koa middleware removing trailing slash from paths.
Downloads
655
Readme
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);