Organize which routes are prefixed with "/api" #818
Merged
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.
This PR aims to organize which routes are prefixed with
/api
and which are not. I moved where/api
is prepended into the individual controllers and out of the routes section in theapp.rs
file, making all starters have the same basis. Changing the scaffold generation to prepend/api
only when the-k api
option is chosen, and not adding it for-k htmx
and-k html
(for the views) is easier to reason about.Before this change, scaffold generation would add a route as
/<resource_name>
to thesaas
starter, but as/api/<resource_name>
torest-api
andlightweight-service
. Instead, the new change would have-k api
add new routes as/api/<resource_name>
while-k htmx
and-k html
add them just as/<resource_name>
. In this case, whether/api
is added is based on whether you are using the-k api
option, and not based on the starter template you chose.