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

Organize which routes are prefixed with "/api" #818

Merged
merged 8 commits into from
Oct 27, 2024

Conversation

isaacdonaldson
Copy link
Contributor

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 the app.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 the saas starter, but as /api/<resource_name> to rest-api and lightweight-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.

@jondot jondot mentioned this pull request Oct 13, 2024
10 tasks
@jondot
Copy link
Contributor

jondot commented Oct 15, 2024

@isaacdonaldson i think this will unlock the bigger picture here: #834

@isaacdonaldson isaacdonaldson marked this pull request as ready for review October 15, 2024 13:36
@isaacdonaldson
Copy link
Contributor Author

@jondot - Is there anything holding this up?

@jondot jondot added this to the 0.12.0 milestone Oct 27, 2024
@jondot
Copy link
Contributor

jondot commented Oct 27, 2024

@isaacdonaldson not at all, we've just made some changes to allow this to be part of a bigger picture of simplifying the starters

I will split this PR into the templates part and starter part will manually migrate the changes to a different existing PR

@jondot jondot merged commit c44ac17 into loco-rs:master Oct 27, 2024
24 checks passed
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.

3 participants