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

Allow Blazor Server app to have API endpoint #30204

Closed
mrlife opened this issue Feb 15, 2021 · 3 comments
Closed

Allow Blazor Server app to have API endpoint #30204

mrlife opened this issue Feb 15, 2021 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.

Comments

@mrlife
Copy link
Contributor

mrlife commented Feb 15, 2021

Is your feature request related to a problem? Please describe.

Rather than adding the complexity of a shared project, that contains EF Core models, to be used by Blazor and an API project, it would be useful to have an API endpoint available in a Blazor Server app.

Describe the solution you'd like

Maybe it is possible, and not documented somewhere I've found, but to add a Controller with an endpoint or handle it in the OnGet of _Host.cshtml would work for this. Is this possible now, or a good fit for a future release?

@javiercn javiercn added the area-blazor Includes: Blazor, Razor Components label Feb 15, 2021
@mrpmorris
Copy link

You can already add api controllers in the usual way. Give it a try. Is there something not working for you?

@mkArtakMSFT
Copy link
Member

Thanks for contacting us. As @mrpmorris has pointed out, this is possible even today. Please clarify what specifically you're having trouble with so that we can try to help you.

@mkArtakMSFT mkArtakMSFT added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Feb 16, 2021
@mrlife
Copy link
Contributor Author

mrlife commented Feb 16, 2021

@mrpmorris @mkArtakMSFT Thanks for getting back to me. Since this is possible, I will close this out. I thought that Blazor Server just had the one endpoint available of _Host.cshtml. I will use the docs for the Web API tutorial to just add the relevant parts to my Blazor app.

@mrlife mrlife closed this as completed Feb 16, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.
Projects
None yet
Development

No branches or pull requests

4 participants