<p><span>Learn ASP.NET Core APIs delivered in its latest version of the Microsoft Framework: .NET 8. This book will show you how to develop APIs with ASP.NET Core 8. Author Anthony Giretti will reveal all you need to know about HTTP protocol, REST architecture style, and ASP.NET Core 8.</span></p><p
Coding Clean, Reliable, and Safe REST APIs with ASP.NET Core 8: Develop Robust Minimal APIs with .NET 8
✍ Scribed by Anthony Giretti
- Publisher
- Apress
- Year
- 2023
- Tongue
- English
- Leaves
- 438
- Category
- Library
No coin nor oath required. For personal study only.
✦ Synopsis
Learn ASP.NET Core APIs delivered in its latest version of the Microsoft Framework: .NET 8. This book will show you how to develop APIs with ASP.NET Core 8. Author Anthony Giretti will reveal all you need to know about HTTP protocol, REST architecture style, and ASP.NET Core 8.
You will learn what reflexes and mindset a developer must have to approach the development of an API of medium complexity. By performing CRUD operations on a SQL Server database, you will see how to set up a clean and reliable application with industry best practices (clean code, security, observability, optimization and testing).
After completing Coding Clean, Reliable, and Safe REST APIs with ASP.NET Core 8, you will be able to develop many kinds of APIs that require a senior developer level of knowledge and provide your customers with high-quality APIs.
What You Will Learn
• Discover the latest version of ASP.NET Core 8
• Code REST APIs with minimal APIs
• Become familiar with clean code principles
• Optimize performances with caching, background tasks and more
• Make APIs resilient by handling SQL and HttpClient transient errors
• Understand the importance of observability
• Implement Authentication and Authorization
• Grasp OWASP principles
• Protect sensitive data
• Master unit testing best practices
Who This Book Is For
Beginner and intermediate professionals wishing to build clean, reliable and safe ASP.NET Core APIs and elevate their skills to a senior developer level.
✦ Table of Contents
Table of Contents
About the Author
About the Technical Reviewer
Acknowledgments
Prerequisites
Introduction
Chapter 1: Introducing HTTP and REST
Unveiling HTTP Behind the Web
The Characteristics of HTTP
HTTP Requests and Responses
HTTP Implementation
HTTP Verbs
HTTP Status Codes
Request and Response Headers
Request Headers
Controls Headers
Conditional Headers
Content Negotiation Headers
Authentication Credentials Headers
Request Context Headers
Response Headers
Control Data Headers
Validator Header Fields
Authentication Challenges Headers
Response Context Headers
URI, URL, and More
URI
URL
And Others…
Parameters
Error Handling
HTTPS, TLS, and HSTS
Let’s Put the Pieces of the Puzzle Back Together
Extend Your Talent on the Web with REST Architecture Style
REST Constraints
REST Good Practices
Base URL
Media Type
URL Naming
API Versioning
API Documentation
Summary
Chapter 2: Introducing ASP.NET Core 8
ASP.NET Core Fundamentals
ASP.NET Core Web API
ASP.NET Core Minimal APIs
Summary
Chapter 3: Introduction to Application Development Best Practices
Getting the Right Frame of Mind
A Basic Understanding of the Business
Problem-Solving Skills
Understanding Programming Paradigms
Logical and Structured Thinking
Clean Architecture Fundamentals
Clean Code Fundamentals
General Coding Fundamentals
Coding Style Fundamentals
OWASP Principles
Summary
Chapter 4: Basics of Clean REST APIs
Routing with ASP.NET Core 8
ASP.NET Core Routing
Setting Up the Correct HTTP Verb
Writing Routes
Using Route Constraints
RouteGroups
Parameter Binding
What’s Precisely Parameter Binding?
Parameter Binding by Example
Validating Inputs
Object Mapping
Managing CRUD Operations and HTTP Statuses
Handling HTTP Statuses
Creating the Services to Handle CRUD Operations
Creating the Endpoints to Handle CRUD Operations
MapPost("/countries", () => { })
MapGet("/countries/{id}", () => { })
MapDelete(“/countries/{id}”, () => { })
MapPut(“/countries/{id}”, () => { })
MapPatch(“/countries/{id}”, () => { })
Downloading and Uploading Files
Downloading Files
Uploading Files
Uploading a Single File or Many Files Without Any Payload
Uploading a Single File or Many Files with a Payload
Validating an Uploaded File
Streaming Content
Handling CORS
API Versioning
Versioning by Headers
Versioning by Route
Documenting APIs
Managing API Versions in Swagger
Adding Comments on Endpoints
Grouping Endpoints by Tag
Other Customizations
Hiding an Endpoint
Deprecating an Endpoint
Describing Endpoint Responses
Summary
Chapter 5: Going Further with Clean REST APIs
Encapsulating Minimal Endpoint Implementation
Implementing Custom Parameter Binding
Example of Custom Parameter Binding from Headers
Example of Custom Parameter Binding from the From Data
Using Middlewares
Using Action Filters
Using Rate Limiting
The Fixed Window Model
The Sliding Window Model
The Token Bucket Model
The Concurrency Model
Global Error Management
Summary
Chapter 6: Accessing Data Safely and Efficiently
Introduction to Data Access Best Practices
SQL-Type Data Access
HTTP Data Access
Architecturing Data Access
Accessing Data with Entity Framework Core 8
Step 1: Creating the CountryEntity Class
Step 2: Creating the EF Core Context
Step 3: Configuring the CountryEntity
Step 4: Generating the Database Model from C#
Step 5: Enabling Resiliency with Entity Framework Core
Step 6: Writing the Repository on Top of the CountryEntity
Accessing Data with HttpClient and REST APIs
Using IHttpClientFactory to Make HTTP Requests
Using Refit to Make HTTP Requests
Using Polly to Make HTTP Requests Resilient
Summary
Chapter 7: Optimizing APIs
Asynchronous Programming
Basics of Asynchronous Programming
Using CancellationToken
Long-Running Tasks with Background Services
Paging
JSON Streaming
Caching
Output Cache
In-Memory Cache
Distributed Cache
Speeding Up HTTP Requests with HTTP/2 and HTTP/3
Summary
Chapter 8: Introduction to Observability
Basics of Observability
Performing Logging
Performing Tracing and Metrics Data Collection
Implementing HealthCheck
Liveness HealthCheck
Readiness HealthCheck
Summary
Chapter 9: Managing Application Secrets
Introduction to Application Secret Management
Example with Azure Key Vault
Summary
Chapter 10: Secure Your Application with OpenID Connect
Introduction to OpenID Connect
Configuring Authentication and Authorization in ASP.NET Core
Passing a JWT into Requests and Getting the User’s Identity
Summary
Chapter 11: Testing APIs
Introduction to Testing
Efficient Unit Testing
Using the Right Tools
Testing a SUT Step-by-Step
Identify What to Test
Create the Test Class
Write the Test
Write the Constructor
Write the Arrange Section
Write the Act Section
Write the Assert Section
Summary
Index
📜 SIMILAR VOLUMES
<p><span>Learn ASP.NET Core APIs delivered in its latest version of the Microsoft Framework: .NET 8. This book will show you how to develop APIs with ASP.NET Core 8. Author Anthony Giretti will reveal all you need to know about HTTP protocol, REST architecture style, and ASP.NET Core 8.</span></p><p
<p><span>Develop web API applications using design patterns, advanced customization, and cutting-edge technologies, such as SignalR, gRPC, and GraphQL, while leveraging powerful cloud platforms and tools to accelerate development</span></p><span>Key Features</span><ul><li><span><span>Gain proficienc
Develop web API applications using design patterns, advanced customization, and cutting-edge technologies, such as SignalR, gRPC, and GraphQL, while leveraging powerful cloud platforms and tools to accelerate development Key Features Gain proficiency in building modern ASP.NET Core web API appli
<h3><span>Create fully featured APIs with the ASP.NET Core framework!</span></h3><p><span>Building Web APIs with ASP.NET Core</span><span> is a practical beginner’s guide to creating your first web APIs using the REST and GraphQL standards. The book is structured just like a real-world development p
<span>Build fully-featured APIs with ASP.NET Core! This all-practical guide is written like a real development project, taking you hands-on with modern APIs utilizing REST and GraphQL standards.</span><span><br><br>In </span><span>Building Web APIs with ASP.NET Core</span><span> you will learn how t