ASP.NET Core Web API .NET 6 2022 - 1. Create Project & Quick Tips
Summary
TLDRIn this tutorial, Teddy introduces viewers to building a Pokémon review system using ASP.NET Web API version 6, emphasizing its importance for C# developers. Aimed at beginners, the video guides through setting up the project in Visual Studio, utilizing the built-in Swagger for API testing instead of Postman. Teddy explains the significance of APIs as a means for programs to communicate securely and intuitively, highlighting the high demand for ASP.NET Web API skills in the job market.
Takeaways
- 🌟 The video is a tutorial on building a Pokémon review system using ASP.NET Web API version 6.
- 👋 Teddy, the presenter, welcomes viewers to his YouTube channel and introduces the topic.
- 📚 The tutorial is beginner-friendly, requiring basic knowledge of C# and object-oriented programming.
- 📈 Web API is highlighted as an important framework for C#/.NET developers, with widespread industry demand.
- 🔍 A UML diagram is provided for reference, serving as a blueprint for the app's structure and functionality.
- 🛠 ASP.NET 6 comes with built-in Swagger, which simplifies API testing and eliminates the need for Postman.
- 💡 Swagger provides a visual interface for API endpoints, making it easier to interact with the API without setting up each request manually.
- 🚀 The tutorial guides viewers through creating a new project in Visual Studio, emphasizing the importance of selecting the correct Web API template.
- 🔑 Open API support is enabled by default to utilize Swagger, and authentication is set to 'None' initially for simplicity.
- 🛑 The 'Program.cs' file is identified as crucial for wiring in functionality and middleware, which processes HTTP requests sequentially.
- 🔄 APIs are likened to 'SQL over HTTP', allowing secure and intuitive access to data through endpoints, facilitating communication between programs.
Q & A
What is the main topic of the video?
-The video is about building a Pokémon review system using ASP.NET Web API version 6.
Why is Web API considered important for C# .NET developers?
-Web API is important because it has become a dominant framework and is often required knowledge in interviews for .NET developer positions.
What level of C# knowledge is expected for this tutorial?
-The tutorial is beginner-friendly and expects the viewer to have a basic understanding of C#, including knowledge of classes and object-oriented programming.
What is the purpose of the provided UML diagram?
-The UML diagram serves as a blueprint for the app, providing an outline to follow during the development process.
What does the built-in Swagger feature in ASP.NET Web API do?
-Swagger provides a visually pleasing interface for testing the API without the need for Postman, allowing users to execute and test API endpoints easily.
What is the significance of enabling Open API support in the project creation?
-Enabling Open API support integrates Swagger into the project, which is necessary for using the built-in API testing features.
Why is the WeatherForecast example controller unnecessary for this project?
-The WeatherForecast controller is a dummy example provided by Microsoft to demonstrate API capabilities and is not needed for the Pokémon review app.
What role does the Program.cs file play in the project?
-Program.cs is the main settings file where functionality such as database support or identity framework can be wired in.
What is the analogy used in the script to explain middleware in web development?
-Middleware is compared to a car wash, where an HTTP request goes through a series of processes or 'cleansing steps' before reaching its destination.
How are APIs described in the video, and what purpose do they serve?
-APIs are described as 'SQL over HTTP,' serving as a way for programs to communicate with each other in an intuitive, secure manner, allowing access to data through endpoints.
What advice is given for learning about APIs and securing a job?
-The advice is to keep learning and practicing with APIs, as there is a high demand for ASP.NET Web API knowledge in the job market.
Outlines
🚀 Introduction to Building a Pokémon Review System with ASP.NET Web API
In this introductory paragraph, Teddy welcomes viewers to his YouTube channel and announces the creation of a Pokémon review system using ASP.NET Web API version 6. He emphasizes the importance of Web API for C# developers and assures that the tutorial is beginner-friendly. Teddy expects viewers to have a basic understanding of C# and object-oriented programming but promises that even with minimal knowledge, one can follow along. He encourages viewers to download a UML diagram that will serve as a blueprint for the app development process. Teddy also mentions the built-in Swagger feature in ASP.NET Web API, which provides a visual interface for testing the API without the need for Postman. He gives a brief overview of how the app will look and assures that the tutorial will be both instructive and user-friendly.
🛠️ Setting Up the ASP.NET Web API Project and Understanding Key Components
This paragraph delves into the setup process for the new project in Visual Studio. Teddy guides viewers on how to create a new Web API project, ensuring they select the correct template for .NET 6 and enabling Open API support for Swagger integration. He explains the importance of the 'Program.cs' file, which acts as the main entry point for wiring in functionality and middleware. Middleware is likened to a 'technological car wash' that processes HTTP requests sequentially. Teddy also clarifies that while APIs may not have a flashy UI, they are crucial for secure and intuitive data access. He simplifies the concept of APIs as 'SQL over HTTP,' explaining how they allow for data retrieval through endpoints tied to database tables. The paragraph concludes with advice on focusing on learning and understanding the core components of the project without getting bogged down by less essential elements.
🌐 Understanding APIs and Their Role in Modern Web Development
In the final paragraph, Teddy discusses the significance of APIs in web development. He describes APIs as a means for programs to communicate with each other, allowing for secure and efficient data exchange. He uses the analogy of Google's vast data, explaining how APIs enable access to specific data through URLs, which are tied to objects or database tables. Teddy clarifies that APIs return data in JSON format, which, while not visually appealing, is practical for quick use in applications like React or for data processing. He encourages viewers to persevere in learning about APIs, despite the initial challenge, as they are in high demand in the job market. The paragraph ends with a call to action for viewers to like, subscribe, and follow along for more educational content.
Mindmap
Keywords
💡ASP.NET Web API
💡Web API
💡Swagger
💡.NET 6
💡UML Diagram
💡Object-Oriented Programming
💡Program.cs
💡Middleware
💡API Endpoints
💡JSON
💡Authentication
Highlights
Introduction to building a Pokémon review system using ASP.NET Web API version 6.
Web API's importance for C# .NET developers and its prevalence in the industry.
Beginner-friendly approach, not requiring extensive C# knowledge, just basic OOP concepts.
Use of a UML diagram as a blueprint for the app development process.
Integration of Swagger for API testing without the need for Postman.
Explanation of how Swagger provides a visually pleasing way to interact with the API.
Instructions on setting up a new ASP.NET Web API project in Visual Studio.
Emphasis on choosing the correct project template for .NET 6 and Web API.
Enabling Open API support to integrate Swagger for API documentation and testing.
The role of Program.cs as the main settings file for wiring in functionality.
Explanation of middleware as a sequential process for HTTP requests.
The significance of APIs as a means for programs to communicate and share data.
APIs described as 'SQL over HTTP' for intuitive data access.
The practical demonstration of API endpoints returning JSON data.
Discussion on the demand and job opportunities for ASP.NET Web API developers.
Encouragement for beginners to stick with learning APIs for career prospects.
Call to action for viewers to like, subscribe, and support the channel.
Transcripts
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
Посмотреть больше похожих видео
Building and Deploying a Basic REST API with Azure App Service, Azure Portal, and Visual Studio
Asp.Net Core Web API Client/Server Application | Visual Studio 2019
Creating a Web API Project
Postman Beginner Tutorial 1 | What is Postman
What is Postman and why everyone use it ?
Adding JWT Authentication & Authorization in ASP.NET Core
5.0 / 5 (0 votes)