ASP.NET Core Web API .NET 6 2022 - 1. Create Project & Quick Tips

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys this is teddy welcome to my youtube channel this video we're going to be building a pokemon review system in asp.net web api version 6 2022 the newest the latest the greatest uh and web api is going to be a very important framework for csharp.net developers um web apis and web api in particular has literally taken over the scene any place that you interview is going to require that you know web api and this is going to be like a beginner friendly like i don't expect you to know a lot about c sharp i expect you to have like a beginner's knowledge you probably need to know like a class a little bit of object oriented programming in order to know what's going on but you could even if you just had a very beginner's level knowledge of this you could still make it work i think and you could still follow along so go ahead download this uml diagram because we're going to be referring to this lot and this is going to give us like an outline like a blueprint of our app we're going to be following along as we kind of go through this and just to kind of show you beforehand like what our app like is actually going to look like apis don't really have like a big ui like they don't they're not as uh visually stunning as a front-end app but the great thing about asp.net web api and uh.net 6 is now they have swagger built into it so you don't need postman and swagger is already built into your api and it's going to give you like a very visually pleasing way to look at our uh um like just imagine our uml diagram is what's going to be viewed in swagger and this is going to give you like a really quick way like watch this you can just go in here you can execute it and it will quickly give you the ability to test your api so we've got electric leaf water right here and yeah like i said it's going to be it's going to save you a ton of time so don't worry about postman because swagger is gonna have everything that we need and yeah it's pretty much okay so enough chit chat let's go ahead let's go into visual studio and we're going to actually create our new project so go down here create a new project on the right and type into our templates we're going to type in web api web api i'm going to bring down my mic here so i can see a little bit better then go to this very first one make sure that you get the linux mac windows c-sharp one because that is indicative of core and make sure like i said make sure it's core make sure it's web api so that you get the the right one and you're not following it wrong along with the wrong template because that's what it's going to do it's going to generate a template for you so we're going to go here and we're going to type in pokemon review app pokemon review app very simple uh self-explanatory name it if you want to name it something different or if you maybe if you even want to create like your own you don't want to even be about pokemon make it a dog review app make it a review app it uh just and just follow along you could definitely do that but if you're a beginner i would just recommend following along with just uh the pokemon so we're gonna go here and make sure it's dot net six because that's the newest one that's kind of the one that you wanna start working on if you're a beginner so that by the time you do get a job you'll be really good at dotnet six make sure open api support is enabled because that is what's going to give you swagger you could just do http but for https i would just go ahead and do that because visual studio is going to handle everything for you make sure use controllers is checked and we're going to go ahead also make sure authentication is none we'll add authentic authentication later so just to kind of get you going the way that you actually start the app is you click this green button right here that's going to go ahead and spin up a web page uh normally i don't think in the past i think it spun up a web page but i don't think like i actually don't really know what it used to but for these purposes nowadays whenever you click that green button in.net 6 you're going to get a swagger screen it's going to like i said give you a nice little gui so that you can look at all of your api endpoints and you won't get confused because postman you have to set everything up but swagger just kind of automates everything and makes everything really easy so unless you're working in a professional environment i would just go with swagger but you i you could use postman if you wanted to all right so whenever you click on that it's going to close out of the app it's going to shut down the actual app and i'll just go ahead and go through here so usually the solution explorer is over on this side but i like to put on that side because it just looks more i don't know vs code like um so a solution many times people are confused about solution a solution can hold multiple projects so if we had multiple apis within our same project you could do that with a solution and that's kind of like what the idea is for a solution but in this case we're not going to um be utilized like solutions to their fullest extent because we only have one project uh let's go like into our actual project i'll tell you what you need and what you don't need so you don't need to learn anything about connected services you don't need to learn anything about dependencies you need to learn what launch settings json is so launch settings json is kind of the way it sounds it's settings for when the app actually launches and you have two settings um you have just a regular app settings which is going to handle uh what is actually going to go on when the app is actually running and then you have launch settings which once again have it's kind of the way it sounds you are going to configure how the actual app launches so got those two knocked out we can just go ahead and delete this uh weather forecast right here we don't even need this and we don't need our controller either microsoft puts like a a dummy weather forecast controller and you may have seen it when we were in swagger but it's really just a way to demonstrate like what the capabilities are uh where stuff is and that's kind of like the reason they put it in there but you don't even really need it all right so probably the most important uh file of all of them is going to be our program.cs think of the program.cs is like the main settings like there's you know obviously there's the app settings to json but this the program file is where you're going to kind of like wire in a bunch a bunch of functionality so uh look at it in two parts you have this stuff up here and then you have all of this stuff down here and the way that microsoft used to do it was this stuff up here is like literally where you just wire in functionality let's say if you wanted to add like database support you would just kind of like wire it in to here and you would be able to access your database or it would provide the functionality for it so whenever you're using some type of module or if maybe if you're using like identity framework if you're using entity framework that's actually where you're going to kind of like install it and just think of that as like what services are and you can see here we've installed swagger we've installed we've installed our controllers it's not really called installing but you know you kind of get the picture you're you know downloading some type of code into your app and you're just you know inserting it into it then you have stuff like this down here this is more middleware so middleware can be described as this whenever you send an http request to something it goes through almost like a car wash like a technological car wash it's not a real car wash of course but it's almost like technological like you go through a car wash and it sprays soap on the car and then it spray you know it blows hot air on the car and then it does all these things to it to clean your car this is kind of like this but in web development so you're going to send like an http request and as this http request goes through the actual app it's going to kind of like blow you know hot air on it but or it's going to do things like authorization you're going to do https redirection it's going to check if they're swagger and it's going to kind of do things sequentially as well too that's like another key point that's why i use the analogy of the car wash it's kind of like a sequential you know thing that you have to do um many people are often confused like what is like an api like why do we even why do we even need apis apis are very important and this is the best way i've ever heard an api explained it's very elegant but people are going to argue about this and people are going to say i'm an idiot and somebody's going to add me on twitter to like try and get in like start a twitter fight with me but the way that the best way i've just heard uh apis described is that it's sql over http so let me elaborate on that a little bit if you google is a huge company with tons and tons of valuable data and one day you too will be working with for a company that is storing tons and tons of valuable data and you can't send sql over the internet like it's just not designed for it so you have code on top of a sql database and this c sharp code is going to make it so that people can you know intuitively access your data through things called endpoints which are basically http or urls and it's going to give people a way that they can grab the data that they need through these urls so in theory like if we just went back to you know swagger you can see that these things are urls and it's tied to kind of like this noun or like this this object or it's tied to our database tables and that's just a url that is going to allow us like i said to access data in ways that we see you know we deem appropriate like and look at it like this like if i just go to this i think i should okay yeah this is like the data in this is what an api is actually returning it's returning json and it's not beautiful it's not pretty but it's returning the exact data that we need and it's returning in a way that you could quickly do something with it like you could display this in react and you could just you could you know maybe download this to your other database and you could have ways that programs are communicating and that's like the whole entire idea of apis it's a way that programs can communicate with each other in ways that are intuitive secure and allow people who are kind of like strangers to your database to access information you know the data that they need so that they can be productive and that is pretty much it that that's about as much as i can go into apis the rest of it you're pretty much just going to kind of have to intuitively learn on your own it's going to be a process it's not going to be you know learning apis is kind of uh like to a certain extent drudgery because you don't know what's going on but if you just keep with it you just keep going it will eventually make sense and you'll get a job in no time because the demand is totally there there's tons of asp.net web api jobs there's tons of opportunity jobs waiting for you at the other side anyway i hope that you guys enjoyed this if you did make sure to hit that like button make sure to hit that subscribe button and as always thank you for watching
Info
Channel: Teddy Smith
Views: 199,628
Rating: undefined out of 5
Keywords: software development
Id: _8nLSsK5NDo
Channel Id: undefined
Length: 12min 10sec (730 seconds)
Published: Mon Jan 03 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.