微型路由器:Zeit的微型微型功能路由器

时间:2024-02-23 19:29:17
【文件属性】:

文件名称:微型路由器:Zeit的微型微型功能路由器

文件大小:62KB

文件格式:ZIP

更新时间:2024-02-23 19:29:17

nodejs router microservice async routing

:station: 微型路由器-ZEIT功能路由器 :OK_hand: 产品特点 小小的。 只需几行代码。 功能。 使用函数编写您的http方法。 异步设计用于async/await :laptop_computer: 用法 安装为项目依赖项: $ yarn add microrouter 然后,您可以在微服务中定义路由: const { send } = require ( 'micro' ) const { router , get } = require ( 'microrouter' ) const hello = ( req , res ) => send ( res , 200 , `Hello ${ req . params . who } ` ) const notfound = ( req , res ) => send ( res , 404 , 'Not found route' ) module . exports = router ( get ( '/hello/:who' , hello ) , get ( '/*' , notfound )


【文件预览】:
micro-router-master
----.gitignore(606B)
----.babelrc(49B)
----.eslintrc(129B)
----package.json(1KB)
----src()
--------utils()
--------lib()
----.travis.yml(123B)
----dist()
--------utils()
--------lib()
----readme.md(5KB)
----license.md(1KB)
----.editorconfig(298B)
----.prettierrc(209B)
----yarn.lock(191KB)

网友评论