hello everybody i'm in this video i'm going to show you how you can add three very important features in your minimal apis in dot net NUMBER_TOKEN. those are swagger support authentication and authorization and also validation support those are things that usually come out of the box in a normal nvc or web api if you want but in minimal apis you have to opt into those features and many of you in my previous two videos talking about minimal apis have actually asked how can i do those things in this context so in this video i'm going to show you just that if you like type of content and you want to see more of my q subscribing this notification bell to get our latest when i upload a new video so let's take a look at what we have currently we have a very simple customers minimal api which you can list all customers you can get a customer by id create a customer update a customer and then delete the customer now we have a repository here which just has things in memory here is just a list of customers in memory and then our record for the customer that's all the code we have now many of you ask how can i wire this thing up in services on how can i add this middleware which basically is the foundation for everything we're gonna do in this video so first and foremost i want to explain how to read this file to know where things are going the first thing i want to show you is this so usually in mvc all structure you have the URL_TOKEN file and that has two methods configure services and configure which is where the middleware goes so looking at this you can think of this as the configure services area and then that area exists up until we call build and we get an app out of it and then from that point on you're essentially in configure mode and that's where all the middleware and all that goes so once you make this separation then everything should just come together because we are using things that are also applicable and usable in the URL_TOKEN structure and the old nvc structure nothing changes under the hood on that front it's just that the way you register endpoints now looks like this and that's it so let's start from the very first thing which is swagger support so i'm gonna go to nuget and i'm gonna go browse and search for URL_TOKEN core and i'm gonna find the package and install it and accept any licenses i have to accept oh nothing oh yeah here we go i need to accept that yep and now the package is in and all you need to do is the following first you need to say URL_TOKEN endpoints api explorer so that's the first thing you need it's a prerequisite and then you need URL_TOKEN swagger then that's it and then we go below that in the configure area like we would do before and we're gonna say URL_TOKEN swagger here we go and then URL_TOKEN swagger ui and really that's it there is nothing else to it i'm gonna go ahead and run this api now but swagger will now automatically detect all those endpoints and i'm actually going to bring swagger up in the browser and as you can see swagger is loaded up and it has all the endpoints i can execute
START_INTERACTION_TOKEN you like type of content and you want to see more of my q subscribing this notification bell to get our latest when i upload a new video so END_INTERACTION_TOKEN