-
Notifications
You must be signed in to change notification settings - Fork 13
Work #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work #218
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
(Of course - me being a complete idiot)
No description provided.