MVC Web API Development: Quick Course Overview
Quick Overview of this Class
MVC Web API Development: Course Overview
MVC Web API Development: Course Overview
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 API Terms and Concepts
Create a Web API Project and Test using Swagger/Postman
Create Web API Project Using VS Code
Create Web API Project Using Visual Studio 2022
Test Web API Calls Using Postman
Using Swagger/Open API to Test API Calls
Understanding and Commenting Program.cs
Test your knowledge of Creating a Web API Project
Finished Lab Samples
Sample Code Demonstrated in this Section
Getting Started with Controllers and Return Types
Adding Product Entity & Repository Classes
Add Product Controller to Return a List of Products
Get a Single Product from the Product Controller
Using the IActionResult Return Type for a List
Using the IActionResult Return Type for a Single Product
Alternatives to the StatusCode() Method
Add Multiple Response Types to Action Methods
Use ActionResult<T> Generic for Returning Data
Test your knowledge of Controllers and Return Types
Finished Lab Samples
Sample Code Demonstrated in this Section
How Routing Works
Overview of Routing and Applying the [Route] Attribute
Multiple URLs on the Same Endpoint
Get a Product by Category ID
Pass Multiple Query Parameters
Pass Multiple Query Parameters as a Query String
Using Parameter Constraints
Test your knowledge of Routes and Parameters
Finished Lab Samples
Sample Code Demonstrated in this Section
Using Dependency Injection
What is Dependency Injection and Why Use It
Service Lifetimes of Injected Objects
Demonstration of a Scoped Lifetime
Demonstration of a Singleton Lifetime
Using an Interface with Dependency Injection
Test your knowledge of Dependency Injection
Finished Lab Samples
Sample Code Demonstrated in this Section
Add Logging to Web API Calls
Introduction to Logging in ASP.NET Core
Using the Built-In Logging to the Console Window
Control the Log Levels Through the appsettings File
Logging an Object
Test your knowledge of logging
Finished Lab Samples
Sample Code Demonstrated in this Section
Add Exception Handling to Web API Calls
The Built-In ASP.NET Unhandled Exception Handler
Create Your Own Exception Controller
Development vs Production Exception Handling
Create a Production Profile in Visual Studio
Handling a 404 Status Code
Log Exceptions and Info Messages to Different Files
Log Exceptions in your Catch Blocks
Test your knowledge of Exception Handling
Finished Lab Samples
Sample Code Demonstrated in this Section
Create Base Controller Class to Reduce Duplicate Code
Create a Custom Base Controller Class
Add Exception Handling to Base Controller Class
Add Serialization of Objects to Base Controller Class
Test your knowledge of a base controller class
Finished Lab Samples
Sample Code Demonstrated in this Section
Reading Configuration Settings Efficiently
Reading Configuration Settings from JSON File
Read Settings into Object, Inject Object
Read Settings, Assign to Each Property in Class
Assign Config Settings Directly to Class
Read Settings and Bind to Class in Program.cs
Dynamic Configuration Settings Using IOptionsMonitor<T>
Test your knowledge of reading configuration settings.
Finished Lab Samples
Sample Code Demonstrated in this Section
Formatting JSON and XML Input and Output
Using Attributes to Affect JSON Serialization
Format JSON Using Global Options in Program.cs
Ignore All Read-Only Properties
Return XML From Web API Calls
Consuming XML in a Post() Method
Test your knowledge of JSON Serialization
Finished Lab Samples
Sample Code Demonstrated in this Section
Call Web APIs From Client-Side and Setup CORS
Create an MVC Website From Which to Make API Calls
Call Web API via JavaScript
Configure CORS to Allow Incoming Web API 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 a Services Collection Extension Class
MVCBuilder and Host Extension Classes
Create Web Application Builder Extension Class
Create Repository Classes Extension Method
Finished Lab Samples
Sample Code Demonstrated in this Section
Securing Web APIs with JSON Web Tokens
Security in ASP.NET
Turn on Authentication and Add [Authorize] Attribute
Overview of JSON Web Tokens
Adding JWT to a Web API Project
Register JWT as the Authentication Scheme
Handling Unauthorized Calls (401 Status Code)
Creating the Entity Security Classes
Creating the Security Manager Class
Create a Security Controller to Generate a JWT
Display the Contents of a JWT
Add JWT Support in Swagger
Securing an Endpoint Using Claims
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
Add the Entity Framework to the Web API Project
Add Data Annotations to the Product Class
Create the DbContext Class
Add the DbContext Class to the DI Services Collection
Read Product Data from the Database
Test your knowledge of the Entity Framework
Finished Lab Samples
Sample Code Demonstrated in this Section
Adding, Editing, Deleting, and Validating Data
Add Methods to the Interface and Repository Class
Insert Products into the Product Table
Update Products in the Product Table
Delete Products in the Product Table
Validating Product Data Using Data Annotations
Finished Lab Samples
Sample Code Demonstrated in this Section
Create Searching Methods
Create a SearchBase and a ProductSearch Class
Add Search Methods to Product Repository Class
Add Search Methods to IRepository Interface
Add a Search Route to Product Controller
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
Create Async Repository Class
Create Async Controller & Get all Products Asynchronously
Get a Single Product Asynchronously
Create Search, Insert, Update, Delete Async Methods
Test your knowledge of asynchronous programming
Finished Lab Samples
Sample Code Demonstrated in this Section