pure-restify:用于 restify 的纯函数式路由

时间:2021-06-21 00:40:52
【文件属性】:
文件名称:pure-restify:用于 restify 的纯函数式路由
文件大小:7KB
文件格式:ZIP
更新时间:2021-06-21 00:40:52
JavaScript 纯修复 允许您将任何 restify 端点转换为纯函数。 而不是在可变响应对象上调用函数,例如: var respond = function ( req , res , next ) { res . send ( "hello, " + req . params . name ) ; next ( ) ; } ; Pure restify 允许你把它变成一个纯函数 var respond = pure ( function ( req ) { return { body : "hello, " + req . params . name } ; } ) ; 通过将这个函数包装在 pure 中,我们可以简单地返回我们想要响应的内容。 Pure Restify 为我们处理 res.send 和 next 调用。 pure 的另一个好处是它还处理期货返回的响应(
【文件预览】:
pure-restify-master
----.gitignore(36B)
----README.md(1KB)
----test()
--------routeSpec.js(4KB)
----examples()
--------pointfree-future()
--------hello-world()
--------futures-world()
----package.json(699B)
----src()
--------route.js(661B)
----.travis.yml(79B)

网友评论