E
E
embiid2021-03-29 23:09:55
ASP.NET
embiid, 2021-03-29 23:09:55

How to specify the path of the standard Web api in Startup?

How, instead of this standard path, can I register that some kind of controller would open, for example Catalog? (web api)

app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapGet("/", async context =>
                {
                    await context.Response.WriteAsync("Hello World!");
                });
            });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Miron, 2021-04-09
@embiid

In theory, there is no implementation in the Web API. You create both the physical and logical layer of the service yourself. And the Web API only gives you a set of (very confusing) standard articulations for various devices.
Therefore, one way or another, you will need to choose the platform on which the Web API wrapper will fall, and the product implementation on top.
Rejecting the physical implementation, and taking full responsibility for its creation, you win in the simplicity of the platform (this is not irony or malice, it really is). Since, despite the number of very tightly coupled joints and Wrb API wrappers, the rules for their joining are uniform, patterns are easy to intuitively remember, and materialization is not such a difficult thing.
MVC, on the other hand, is already an implementation, and here both routing and every deviation from the steps prescribed by the implementation is almost a lost cause.
For this reason, MVC is used in the UI. Here, there is less attention to how optimally the machine typesets the page, but the ability to colorize the text with images and effects to capture the user's imagination has all the tools.
Web API is a platform when every cog of the machine needs to be subordinated to data transfer. This makes it possible to build aircraft assembly enterprises on a bunch of relatively cheap two-processor machines, saving millions of dollars on computers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question