167. Should I Create A Minimal API Or Full API?

167. Should I Create A Minimal API Or Full API?

IAmTimCorey

1 год назад

42,936 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@manasi-v9i
@manasi-v9i - 17.08.2023 15:03

Sir ❤❤

Ответить
@rendellgood
@rendellgood - 17.08.2023 15:05

Wow I am literally in the middle of making this decision. Fantastic timing!

Ответить
@rikudouensof
@rikudouensof - 17.08.2023 15:11

Thanks for the video. Most videos you keep saying it. Avoid the complexity if it is not necessary.

Ответить
@PyronTheMage
@PyronTheMage - 17.08.2023 15:14

Not sure if you already have a video but I'd like to see a "Should I use Razor Pages or MVC Controller/Views) video. I personally thought you can use both and to use Razor Pages for page-based scenarios but anything too complex then use or refactor to MVC controller/views.

I see a lot of people saying "so glad I changed to Razor Pages and I've never looked back" and "MVC is dead" and I don't understand this.

I've seen projects with a large collection of actions on 1 MVC controller. The view may have a lot of forms embedded on it with an action for each Post request that accepts all different Form Input Models, or the controller returns several different views and may, or may not, share the same view model (usually not a good idea to share view models but maybe there's a technical constraint). In this scenario, Razor Pages sounds like the wrong tool.

Ответить
@cissemy
@cissemy - 17.08.2023 16:04

Does minimal api gives better performance vs controller api?

Ответить
@dennisvandermeer8238
@dennisvandermeer8238 - 17.08.2023 16:09

Do note that Controller-based API have some overhead that Minimal API does not have. For example Minimal API is missing Content Negotiation. As most (if not all) APIs only communicate in JSON this does not have a big impact and otherwise you'll have to add it manually (haven't figured out how to do this. Filters?). So Minimal APIs are faster.

Ответить
@AmirHosseinBagheri
@AmirHosseinBagheri - 17.08.2023 19:16

@IAmTimCorey
I would argue against it in large organizations. I believe in templates more than simplicity. This gives the leverage of getting people onboard easily in an agile teams with turnovers.

Ответить
@RicusNortje
@RicusNortje - 17.08.2023 22:30

I ran tests and also found that minimal API's are faster than MVC as you don't automatically get all the middleware (you have to explicitly opt into them). So I use that for bespoke gateway with YARP for rewriting but endpoint when I need extra logic but then back end services still use MVC as they are more complex and benifit form the structure

Ответить
@monirahmad133
@monirahmad133 - 18.08.2023 01:56

You are answer my internal myself question, really thanks 🎉

Ответить
@dasfahrer8187
@dasfahrer8187 - 18.08.2023 02:35

Controllers really aren't necessary anymore as the minimal API can be built out to be as exactly complex as necessary. They're so good.

Ответить
@blackpaw29
@blackpaw29 - 19.08.2023 05:35

Basically... it depends lol :), not disagreeing.

A lot of my formative experience predates MVC and I never really got into it. Most of my work is backend services for data processing, which suit minimal apis well. My impression of MVC, is that its best used with User GUI's with a solid focus on standard CRUD.

Ответить
@Anton-Os
@Anton-Os - 19.08.2023 12:07

Thank you!

Ответить
@reynaldoruizflores
@reynaldoruizflores - 24.08.2023 03:51

How many types of API's exist, and which ones are the modern ones? And which can be handled by Microsoft Technology?

Ответить
@DannyHodge95
@DannyHodge95 - 12.09.2023 17:55

Maybe I'm old school, but I'm very hesitant to pick up minimal API's in most scenario's. I do find that the fully structured API's are much easier to read/debug once they hit a certain size, and lets be honest, how many times does a "Small API" turn into a behemoth in industry?
Perhaps this is just my experience though, curious if anybody else has experienced anything similar...

Ответить
@patrickizekor6463
@patrickizekor6463 - 13.09.2023 14:08

Hi Mr Corey, Many thanks for your great videos that supports the developer community. Please i was wondering what project template in Visual studio is used for the development of minimal api's.

Ответить
@kandycan
@kandycan - 17.09.2023 05:16

I think u should never go from controller based structure to minimal API structure. Reason is, codebase will surely get more and more complex even if it's not complex right now. Controllers provide separation of concerns. Now sometimes you may go for minimal API approach especially when you are breaking down monolithic architecture into microservices.

But then in case of microservices and API code that won't expand or have more APIs or endpoints for different entities, then go for it. Make minimal API and let it run for years.

Ответить
@acodersjourney
@acodersjourney - 26.10.2023 05:23

Your passion and dedication shine through.

Ответить
@ionutb123
@ionutb123 - 12.11.2023 00:36

hi Tim, love your videos, I’m new to programming and I noticed that with Next.js, Blazor “United” and so on, you don’t need an API anymore, is that a trend? Thanks

Ответить
@paulgehrman
@paulgehrman - 04.12.2023 02:35

Hi Tim, I love your comments about design patterns. I've been involved in software development for over 25 years and I've seen a lot of code bases. The single biggest issue by far in almost all bad code bases (with no close second) is the overuse of design patterns. Most of the time, code that is heavy with design patterns is nearly impossible to maintain, hard to read,, brittle etc. It is sad that design patterns are still pushed as much as they are, especially when there are often much simpler and robust alternatives. I appreciate you cautionary view, which is, for the most part, sorely missing in our community.

Ответить
@chrisnuk
@chrisnuk - 10.12.2023 13:38

True creativity requires the discipline to harness the chaos of imagination into the simplicity of brilliance

Ответить
@torrvic1156
@torrvic1156 - 14.12.2023 12:54

Thanks a lot for the insight, Tim! This clarifies a lot.

Ответить
@hyxper2989
@hyxper2989 - 12.01.2024 12:38

I think the real answer here is like what Tim said "it depends on your situation". I think my time in this space has taught me that most people try and denote solutions as "go to" or "old". I think a similar issue has spawned in the API space where developers who are trying to be cutting edge have heard that "Minimal APIs are the go to" and wont even consider looking at controller derived solutions. I think you just need to consider what is best for your solution. Need a micro service or simple API? great use a minimal solution and spin something up really quick. Need something with a little more control? Awesome then spin up a controller based solution and add some unit tests. I think if you can justify your decision, and it makes sense in terms of the business case, both solutions are equally as worthy. I just always try to not consider anything to be black or white, but what is going to work for me/my team.

Ответить
@lkarabeg
@lkarabeg - 12.02.2024 15:53

While this is good general advice, I feel like it doesn't address the question in the title. I expected more concrete advice, e.g. "If you need action filters, you should use controllers" (true at the time the video was made).

Ответить
@CodeToLive-ms4jm
@CodeToLive-ms4jm - 15.04.2024 09:41

thank you a lot for the explaniation!! I used to use design pattern all the time even if it 's simple project, but after this video I guess I will reduce using it

Ответить
@SayWhaaaaaaaaaaaaaaaaaaaaaaat
@SayWhaaaaaaaaaaaaaaaaaaaaaaat - 20.06.2024 16:21

AUDIO ASYNC IS SOO HORIBLE IN THIS VIDEO

Ответить
@keyser456
@keyser456 - 02.11.2024 10:07

How have you not talked about convention vs. configuration? Rhetorical question

Ответить
@Ezekielzzz2025
@Ezekielzzz2025 - 06.01.2025 02:42

I strongly prefer using Minimal APIs over controllers because they are lightweight, straightforward, and efficient, avoiding the clunky, heavy, and often slow nature of controllers; with Minimal APIs, I simply pair them with a service using EF Core and an interface per model, resulting in a clean, fast-to-develop architecture that I have successfully leveraged to build an enterprise-level Blazor Server application in less than a few months and a MAUI Blazor app, both of which share nearly identical API implementations, making the solution not only easy to maintain but also highly scalable.

Ответить
@Wezo6666
@Wezo6666 - 13.03.2025 17:42

I think controllers are more reable at first glace i can just know from a controller and its method name what to suppose to do .( if you name correctly 😂)

If use minimal apis i have read through a file to find the endpoint i am looking for

To me minimal apis are just code blocks without the the surrounding method name and parms

Ответить
@danielhen
@danielhen - 20.03.2025 12:56

I don’t get it.. I can separate files easily and beautifully win minimal.. I don’t get the controllers benefit.. probably because I comes from Node

Ответить