Koa middleware removing trailing slash from paths.
npm install koa-no-slashKoa middleware removing trailing slash from path.
- nodejs v14+
- add type=module in your package.json as middleware is exported as ESM
Install:
``bash`
yarn add koa-no-slash
Usage:
`javascript
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);
``