• Post category:StudyBullet-13
  • Reading time:15 mins read


Learn Minimal Web API with Visual Studio, Security, CRUD, CORS, Swagger and Reusability are all covered in this course.

What you will learn

What is a Minimal Web API?

Build a Minimal Web API Project

Use PostMan and Swagger to Test API Calls

Using the MapGet(), MapPost(), MapPut() and MapDelete() Methods

Build a Router Base Class to Simplify Your Minimal APIs

Add Logging to your Web API Calls

Add Exception Handling to your Web API Calls

Develop a Complete Set of CRUD APIs

Call your Web APIs from JavaScript/jQuery

Add CORS to Allow Cross-Domain Calls

Securing Minimal Web APIs

Creating Asynchronous API Calls

Description

Using Web APIs, you can write code to expose just what you want to the outside world. Traditionally you used MVC with controllers to create Web APIs. Starting with .NET 6, Microsoft released a new method for creating Web APIs called the Minimal Web API. This new approach is simpler than MVC. In this course you learn how to use these minimal calls and how best to architect them to provide scalability and ease of maintenance. Even if you have never created a Minimal Web API before, this course guides you step-by-step through the entire process.

In this course you are provided with an overview of the new Minimal Web APIs paradigm. You build a Minimal Web API project and learn to consume Web APIs using Postman and Swagger. You learn the standard methods for getting, inserting, updating, and deleting data. You build a set of CRUD APIs to allow a developer to interact with your database. You then build a set of classes that make working with minimal APIs much simpler. You are going to see how to call your APIs via JavaScript/jQuery and how CORS is added to allow cross-domain access. You learn the basics of securing your minimal Web APIs. You also learn to use the Entity Framework to communicate to a database, and even perform asynchronous Web APIs.


Get Instant Notification of New Courses on our Telegram channel.


All the demos you are shown during this course are backed up with a set of labs for you to perform. Walking through these labs step-by-step ensures that you understand the concepts illustrated in each lesson. You are going to see approximately 90 demos, be asked over 65 questions, and perform over 75 hands-on labs.

Join Paul D. Sheriff, one of the best instructors in the industry, on your journey to becoming a C# Web API developer using the Minimal Web API.

English
language

Content

Introduction

Introduction

Web API Fundamentals

What is a Web API
HTTP Status Codes and Verbs
ASP.NET and It’s Components
Routes, Endpoints and Dependency Injection
Middleware Fundamentals
Minimal Web API Overview
MVC Web API Overview
Test your knowledge of Web APIs

Create a Web API Project and Test using Swagger/Postman

Create a Minimal API Project Using VS Code
Create a Minimal API Project Using Visual Studio 2022
Using Postman to Test APIs
Add Swagger/Open API Support to VS Code
Add Swagger/Open API Support to Visual Studio 2022
Comment the Program.cs File for Better Readability
Test your knowledge of creating and testing a Web API project.
Finished Lab Samples
Sample Code Demonstrated in this Section

Routes and Return Types

Creating Your First Minimal APIs
Specifying Return Types
Return an Object
Return a List of Product Objects
Return a Single Product from Repository
Return a 404 Not Found for a Single Product
Return a 404 Not Found for List of Products
Grouping APIs
Documenting Return Values
Test your knowledge of Routes and Return Types
Lab: Starting Code
Finished Lab Samples
Sample Code Demonstrated in this Section

Using Dependency Injection

Dependency Injection Overview
Service Lifetimes
Create a Settings Class and Use as a Scoped Lifetime
Differences Between Scoped and Singleton Settings
Using an Interface in Dependency Injection
Test your knowledge of Dependency Injection
Finished Lab Samples
Sample Code Demonstrated in this Section

Organize your APIs Using Router Classes

Using a Router Class
Create Router Base Class and Product API Router Class
Get Single Product in Router Class
Injecting Into Router Classes
Create the Simple API Router Class
Create the Settings API Router Class
Test your knowledge of using Router classes.
Finished Lab Samples
Sample Code Demonstrated in this Section

Add Logging to Web API Calls

How Logging Works in Web API Projects
Logging Messages to the Console Window
Setting the Log Level Through the Configuration File
Logging an Object Using the JSON Serializer
Logging to a Text File Using Serilog
Test your knowledge of Logging.
Finished Lab Samples
Sample Code Demonstrated in this Section

Add Exception Handling to Web API Calls

Built-In Exception Handling
Exception Router Class
Development and Production Exception Handling
Different Profiles for Development and Production
Handling 404 Status Codes
Log Exceptions Into a Different File
Log Exceptions in a Catch Block
Test your knowledge of Exception Handling
Finished Lab Samples
Sample Code Demonstrated in this Section

Modify RouterBase Class to Reduce Duplicate Code

Add Properties to Router Base Class
Add Exception Handling to RouterBase
Add a Serialize Entity Method
Test your knowledge of the RouterBase class
Finished Lab Samples
Sample Code Demonstrated in this Section

Reading Configuration Settings Efficiently

Configuration Providers and JSON Files
Reading Settings Individually
Read Settings into a Class
Assign Config Settings Directly to Object
Read Settings in Program.cs
Test your knowledge of Configuration Settings
Finished Lab Samples
Sample Code Demonstrated in this Section

Configure and Format JSON Data

Formatting JSON Using Attributes
Format JSON Using Configuration Options
Ignore Read-Only Properties & Customer Formatters
Test your knowledge of Formatting JSON data.
Finished Lab Samples
Sample Code Demonstrated in this Section

Call Mimimal Web APIs From Client-Side and Setup CORS

Create an MVC Website
Call a Web API from JavaScript/jQuery
Add CORS to Enable Cross Domain Calls
Test your knowledge of CORS
Finished Lab Samples
Sample Code Demonstrated in this Section

Organizing the Program.cs File for Readability

Create a Constants Class
Create Extension Methods
Extension Methods for JSON and Serilog Configuration
Extensions for Settings, Repository, and Router Classes
Finished Lab Samples
Sample Code Demonstrated in this Section

Securing Web APIs with JSON Web Tokens

Security in ASP.NET
Add and Configure Authentication and Authorization
An Explanation of JSON Web Tokens
Add JWT to your Web API Project
Register JWT Authentication with ASP.NET
Create Security Classes
Create Security Manager Class for Authentication
Generate JWT and Authenticate User
Display Contents of JWT at jwt.io
Add JWT Support in Swagger
Secure an Endpoint Using Claims
Handling 401 and 403 Status Codes
Test your knowledge of ASP.NET security
Finished Lab Samples
Sample Code Demonstrated in this Section

Get Data From a Database Using the Entity Framework

Install the Entity Framework into your Project
Add Data Annotations to Product Class
Create DbContext Class and Add Connection String
Add DbContext Class to Services Container
Get Products from the SQL Server Table
Get a Product from the SQL Server Table
Test your knowledge of the Entity Framework
Finished Lab Samples
Sample Code Demonstrated in this Section

Adding, Editing, Deleting, and Validating Data

Add Modification Methods to Repository Class
Add Insert Method to Product Classes
Add Update Method to Product Classes
Add Delete Method to Product Classes
Add Validation Data Annotations to Product Class
Add a Validation Helper Class
Modify the Insert() Method to Check Validation
Modify the Update() Method to Check Validation
Finished Lab Samples
Sample Code Demonstrated in this Section

Create Reusable Searching Methods

Create a SearchBase and ProductSearch Class
Add BindAsync() Method to Search Class
Add Search Methods to Product Repository
Add Search Methods to IRepository Interface
Add Search Route and Test
Finished Lab Samples
Sample Code Demonstrated in this Section

Making Asynchronous API Calls

Introduction to Asynchronous
How Asynchronous Web API Calls Work
Introduction to async, await and Task<T>
A Simple Sync/Async Demonstration
Getting All Products Asynchronously
Get a Single Product Asynchronously
Add all Other CRUD Asyncronous Calls
Test your knowledge of Asynchronous programming
Finished Lab Samples
Sample Code Demonstrated in this Section