【文件属性】:
文件名称:koa-no-trailing-slash:中间件,将所有请求重定向到带有尾部斜杠的URL到没有该URL的同一URL
文件大小:5KB
文件格式:ZIP
更新时间:2021-02-03 17:39:10
redirects middleware koa KoaJavaScript
Koa中间件,将所有请求重定向到带有尾部斜杠的URL到没有URL的同一URL,而忽略查询字符串(键和值)。
安装
npm install koa-no-trailing-slash
用法
const app = new ( require ( 'koa' ) ) ;
app . use ( require ( 'koa-no-trailing-slash' ) ( ) ) ;
app . use ( async ( ctx , next ) => {
ctx . response . body = 'Did this URL had a trailing slash?' ;
} ) ;
【文件预览】:
koa-no-trailing-slash-master
----.gitignore(32B)
----README.md(694B)
----test()
--------index.js(1KB)
----package.json(733B)
----index.js(347B)
----yarn.lock(7KB)