Skip to content

React SPA template is cumbersome to use when adding new API routes due to the proxy requirement #37103

Closed as not planned
@Eilon

Description

@Eilon

In the React SPA template there is a file setupProxy.js that seems to control which client HTTP requests get routed to ASP.NET Core (or not):

https://github.com/dotnet/spa-templates/blob/main/src/content/React-CSharp/ClientApp/src/setupProxy.js#L8-L16

I found it a bit cumbersome to have to edit that file when I added new APIs. I ended up grouping all my APIs into /api so that I could just add one entry:

const context = [
    "/weatherforecast",
    "/api",
];

Would it make sense to have some common prefix such as /api so that many common scenarios would just work without having to edit this file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-templates

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions