Re:The melting pot of JavaScript (2017)
by hombre_fatal on Monday January 07, 2019 @06:06PM
(#18851218)
One example would be a url router for a web server that turns the url variables into the handler's expected argument type and ignores requests that do not.
[ Parent
| on HN ]
Re:The melting pot of JavaScript (2017)
by tracker1 on Tuesday January 08, 2019 @03:52PM
(#18859565)
That would be relatively easy to do something very similar with middleware for express/koa
router.get('/users/:id'. skipNonUuid(id => ...))
You simply have a function/middleware that does the check.... or `compose(skipNonUuid, dbo.findUserById, ui.formatView('modelName'))`You can do function composition that is nearly as simple and far more flexible in general with JS