
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
ette-router
Advanced tools
[](https://travis-ci.org/boycgit/ette-router) [](https://coveralls.io/github/boycg
Router middleware for ette.
npm install ette-router --save
var Router = require('ette-router');
Include the pre-built script.
<script src="./dist/index.umd.min.js"></script>
npm run build
npm test
example: https://repl.it/@boycgit/ette-router-param
test your router rule: http://forbeslindesay.github.io/express-route-tester/
npm run doc
then open the generated out/index.html
file in your browser.
注:你写路由匹配规则时的 /
是很重要的,但你在用 request
方法中的 path 里的 /
则是无关紧要的;
你需要区分 路由规则 和 中间件 这两个概念。
直接使用 use
的是 中间件 :
router.use('/', function(ctx, next) {
// your code...
return next();
});
使用 HTTP.verb() 的时候,定义的则是 路由规则:
router.get('/', function(ctx, next) {
// your code...
return next();
});
路由规则 本质上也是中间件
在代码层面,这部分差别是在 Router#match() 方法返回的
MatchedRouter
类型的route
属性是否是true
来区分的,如果为true
表示路由规则,如果是false
表示定义是中间件
注意:只有当匹配路由规则的时候才会运行相关的中间件,匹配中间件上的 path 并不会运行中间件!!
MIT.
FAQs
[](https://travis-ci.org/boycgit/ette-router) [](https://coveralls.io/github/boycg
We found that ette-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.