Building a Web API in .NET 6 | Minimal API

preview_player
Показать описание
In this tutorial we’ll build a Web API in .NET 6 aka Minimal API. With just a few lines of code we can not only setup the endpoints for a fully-fledged CRUD API class, but it sets the tone for an entire enterprise application.

By the end of this tutorial, you will know:
- How to create a Minimal API project
- Create and register services with interfaces
- Expose service methods through the API and subsequently, data through repositories
- Create Web API methods in the Minimal API .NET 6 style

For this tutorial there are two pre-requisites .NET 6 and Visual Studio 2022. But not to worry I’ll show you where to download them from (check out the Useful Links section below). The installation is pretty straight-forward, only follow the recommended installation wizard for both cases.

👍If you enjoyed this tutorial, please like this video consider subscribing for more content like this!

0:00 – Intro
0:30 - Download .NET 6 SDK
0:54 - Download Visual Studio 2022
1:31 - Create Minimal API Project
2:20 - Project Overview
4:19 - Test the endpoint with Postman
6:08 - Add a Data Model
7:25 - Add a Data Repository
8:30 - Add Service Interface
12:58 - Add Service Implementation
17:29 - Setup Minimal API Endpoints
18:51 - Setup Create Minimal API Endpoint
21:40 - Setup Get Minimal API Endpoint
23:06 - Setup List Minimal API Endpoint
23:48 - Setup Update Minimal API Endpoint
25:49 - Setup Delete Minimal API Endpoint
28:52 - Test Minimal API Endpoints with Postman

Useful Links:

Credits:
Рекомендации по теме
Комментарии
Автор

Nice! The service implementation is much cleaner than putting all the code in program.cs. Thank you!

pointandshootvideo
Автор

Nice channel, good the channel should grow quickly!

alan-
Автор

Thanks for the video! I have a question. When we post a json from postman, where are these data stored? I published the api to iis but I see not changes to the website folder when I post a new json.

atonakis
Автор

Can I ask, when you're setting up the endpoints in program.cs, what's the reasoning for declaring the results of the service calls as vars rather than as what the interface defines them as ? Is it something to do with inversion of control??
Thanks

alan-
Автор

I am really happy to find you. I was looking for a guide to improve and better understand to code with blazor and .Net. Also i have a question about some specific topic. Its about google maps with signalR. I want to develop a navigation application. Database provides real time coordinates(i'll try to simulate this) and i show the location of person and route of the way the person wants to reach. I don't want to show the estimated time etc. But i couldn't find resource and package for this kind of map support. Do you know any package for my question. Thank you for all content you created for youtube and your answer.

sylinxstark
visit shbcf.ru