Express like syntax proposal#1
Express like syntax proposal#1mcollina merged 9 commits intofastify:masterfrom delvedor:express-like-syntax
Conversation
mcollina
left a comment
There was a problem hiding this comment.
little nits and a missing unit test
| const router = wayfarer() | ||
| const map = new Map() | ||
|
|
||
| beo.route = route |
There was a problem hiding this comment.
can you keep the test on for that?
| schema: schema, | ||
| handler: handler | ||
| }) | ||
| } |
There was a problem hiding this comment.
can you add a unit test for post?
There was a problem hiding this comment.
we should also add body-parser to read the body (assume JSON for now).
|
To support POST I've added a body parser, I chose I also re-exposed |
beo.js
Outdated
| handleNode(handle, params, req, res, body) | ||
| }) | ||
| } else { | ||
| throw new Error(`${req.method} method is not supported!`) |
There was a problem hiding this comment.
Don't throw. Return a 404.. and add a test about that :D
beo.js
Outdated
| jsonParser(req, function (err, body) { | ||
| if (err) throw err | ||
| handleNode(handle, params, req, res, body) | ||
| }) |
There was a problem hiding this comment.
this function definition is hoisted, which means it will be allocated even if we do not use it. Move this body-parsing thing into its own function.
|
|
||
| beo.post('/', schema, function (req, reply) { | ||
| reply(null, 200, req.body) | ||
| }) |
Electrode initial implementation
Add Greenkeeper badge 🌴
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
As titled.
The user has an express like API, while we have a more easy to manage options object.