Conversation
|
An automated preview of the documentation is available at https://218.http-proto.prtest.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2025-12-17 15:28:50 UTC |
|
GCOVR code coverage report https://218.http-proto.prtest.cppalliance.org/gcovr/index.html Build time: 2025-12-17 15:41:54 UTC |
MungoG
left a comment
There was a problem hiding this comment.
Also, it does feel like the documentation probably belongs in github.com/cppalliance/beast2 rather than github.com/cppalliance/http_proto
| |Close the connection after sending any response. | ||
|
|
||
| |`route::complete` | ||
| |Request fully handled; no response to send. |
There was a problem hiding this comment.
It is not clear from the docs what happens as a result of returning this. Suggest including its use into an existing (or new) example.
| |Continue to the next handler in the chain. | ||
|
|
||
| |`route::next_route` | ||
| |Skip remaining handlers in this route, try the next route. |
There was a problem hiding this comment.
This needs an example or more description.
| The router tries each matching route in registration order. If a handler | ||
| returns `route::next`, the router continues to the next handler. If all | ||
| handlers return `route::next`, dispatch returns `route::next` to indicate | ||
| no handler produced a response. |
There was a problem hiding this comment.
It is not clear from this text what happens if the final handler returns route_next. Does it get translated to next or does this function also have to handle route_next.
There was a problem hiding this comment.
yes this needs to be explained. the call to router::dispatch will return route::next which is an error
| == Handler Chaining | ||
|
|
||
| Multiple handlers can be registered for the same route. They execute in | ||
| order until one returns something other than `route::next`: |
There was a problem hiding this comment.
or, presumably, route::next_route
| idiomatic C++ | ||
|
|
||
| - In the C++ router, route handlers are declarative rather than imperative. They | ||
| package up the response using a Sans-IO API. Beast2 handles the sesnding |
There was a problem hiding this comment.
| package up the response using a Sans-IO API. Beast2 handles the sesnding | |
| package up the response using a Sans-IO API. Beast2 handles the sending |
Add initial documentation for the Express.js-style router API covering: - Handler signatures and return values - Adding routes with add() and all() - Fluent route() interface - Dispatching requests - Handler chaining - Path patterns - Router options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
If we do that, then what will the http-proto docs have? |
| router.add(method::post, "/users", create_user); | ||
| router.add(method::get, "/users/:id", get_user); | ||
| router.add(method::put, "/users/:id", update_user); | ||
| router.add(method::delete_, "/users/:id", delete_user); |
There was a problem hiding this comment.
🤦
(Of course - me being a complete idiot)
No description provided.