Skip to content
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

Added Catchall route to Crow #126

Merged
merged 11 commits into from
Apr 14, 2021
Merged

Added Catchall route to Crow #126

merged 11 commits into from
Apr 14, 2021

Conversation

The-EDev
Copy link
Member

Based on @Tibbel's work in #121 and #122. Main differences are:

  • Functionality is no longer enabled by a macro.
  • A macro similar to CROW_ROUTE is used (CROW_CATCHALL_ROUTE).
  • The lambda used can have no parameters, only request, only response, or both (similar to CROW_ROUTE).
  • Example is (in my opinion) simpler and gets compiled with the rest of the examples (using Cmake).
  • Added UnitTest.
  • Added Reference and Guide documentation.

Thanks again to @Tibbel for suggesting the idea and creating the first implementation.

closes #123

Tibbel and others added 8 commits April 5, 2021 09:44
Here is the modified catchall-function
example added
the code moved to routing.h
only the setter remained in app.h
the integer return is removed
i personally don't need the default parameters:
without crow::response the catchall can take no effect
and without crow::request you know nothing about the request
i only imagine one case, this is to set custom error pages.
so i don't thing default parameters have any big benefit here.
"#ifdef CROW_CATCHALL" was only for me, to find my own modifications feel free to replace it
Add a catch-all handler 2nd version
CROW_CATCHALL #endif if moved
Add a catch-all handler 2nd version
the macro is similar to CROW_ROUTE, added example to cmake, added unit test, and documentation
@The-EDev The-EDev requested a review from mrozigor April 12, 2021 07:49
include/crow/routing.h Outdated Show resolved Hide resolved
@The-EDev The-EDev merged commit 027db78 into master Apr 14, 2021
@The-EDev The-EDev deleted the catch_all branch April 14, 2021 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a catch-all handler as an alternative to returning 404
3 participants