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

Separate Web and API concepts? #542

Open
DerekChasse opened this issue Apr 24, 2023 · 5 comments
Open

Separate Web and API concepts? #542

DerekChasse opened this issue Apr 24, 2023 · 5 comments

Comments

@DerekChasse
Copy link

DerekChasse commented Apr 24, 2023

I think that it would benefit those using this project to have an option which is API only as opposed to a traditional Web project which also includes the API within.

Pulling out controllers and views which are redundant can be tedious.

If a web project is also desired, it could be also be included. It could take a "Connected Services" dependency on the API via it's generated Swagger document.

@ardalis
Copy link
Owner

ardalis commented Apr 24, 2023

I'm with you 100% and the next version will be API -only (or will have that as an option, anyway)

@ardalis
Copy link
Owner

ardalis commented Apr 24, 2023

Perhaps it's time for a pair of templates:

  • CleanApi
  • CleanWeb

Thoughts? Add emoji to this comment.

@DerekChasse
Copy link
Author

I think a single template would still be sufficient.

If you only want the API, just delete the Web project.

If you want the web, you would need an API to power it. The "add connected service" feature in VS would be able to connect the two... Or for a more independent version, a tool can generate the client from the API project.

That's just my two cents though. Perhaps that's being " too clever " and two separate projects would suffice.

@eduardogoncalves
Copy link
Contributor

Hey @ardalis!
Yesterday, I was thinking about this. I believe having separate templates for MVC, Razor Pages, WebApi, ApiEndpoints, and FastEndpoints, could make the development process a lot smoother and easier, especially for beginners.

@ardalis
Copy link
Owner

ardalis commented May 2, 2023

Yesterday, I was thinking about this. I believe having separate templates for MVC, Razor Pages, WebApi, ApiEndpoints, and FastEndpoints, could make the development process a lot smoother and easier, especially for beginners.

For sure! But it would also multiply the effort of maintaining the templates by N (where N is the number of variants). Unless I come up with some code generation approach or something that reduces that effort, I'm not sure how soon I'll be able to support that many variations. Since my own use cases recently are mostly APIs, I'm probably going to support that as the primary "default" version and provide instructions on how to add Razor Pages or MVC Views to that template if needed, is my current thought. Open to ideas and contributions, though.

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

No branches or pull requests

3 participants