Improve Middleware documentation and compile time static assertions#864
Draft
Guiorgy wants to merge 3 commits intoCrowCpp:masterfrom
Draft
Improve Middleware documentation and compile time static assertions#864Guiorgy wants to merge 3 commits intoCrowCpp:masterfrom
Guiorgy wants to merge 3 commits intoCrowCpp:masterfrom
Conversation
a variant of contains that compares types using std::decay
it checks if a type pack is a subset of another type pack using contains_decayed
…the types of the arguments passed to the constructor
Member
|
closed, author will reopen it when he will proceed to work on it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #861
Currently there is some ambiguity in the documentation surrounding middlewares:
CROW_MIDDLEWARES: In the reference docs the example usescrow::SimpleApp, yet the example in Crow/examples states// ALL middleware (including per handler) is listedand the guide doesn't mention this at all:It needs to be clarified, does
CROW_MIDDLEWARESrequire the specified middleware be also specified in the referenced app template arguments?The reference docs mention the Crow constructor
Construct Crow with a subset of middleware., yet this is not explained in the Guide, and there's no example of the usage in the examples.The guide should include a section on configuring middlewares, which should include both with the constructor and with
app.get_middleware<>.The examples should include an example on using the app constructor.
Also, we can reduce the confusion by implementing compile time static assertions:
CROW_MIDDLEWARES, it should be validated that the type of that middleware is within the middlewares defined in the app class template types.TODO:
CROW_MIDDLEWAREScomment and example.app.get_middleware<>.CROW_MIDDLEWARES.As of writing, the PR includes an implementation that validates middlewares passed to the app constructor, however, the current implementation uses
std::decaywhen comparing types. This needs to be discussed. It also needs more testing for edge cases IMO. Also, I'd like to do the same forCROW_MIDDLEWARESbut I don't know where to do so, a suggestion would be appreciated.