My Account Log in

1 option

Web API Development with ASP. NET Core 8 : Learn Techniques, Patterns, and Tools for Building High-Performance, Robust, and Scalable Web APIs / Xiaodi Yan.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Yan, Xiaodi, author.
Language:
English
Subjects (All):
Microsoft .NET Framework.
Application program interfaces (Computer software).
Web applications.
Physical Description:
1 online resource (804 pages)
Edition:
First edition.
Place of Publication:
Birmingham : Packt Publishing, [2024]
Summary:
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 applications Develop the skills to effectively test, debug, and secure your web API applications Streamline development workflows and boost productivity with cloud computing platforms and industry-standard CI/CD tools Purchase of the print or Kindle book includes a free PDF eBook Book Description Web API applications have become increasingly significant in recent years, fueled by the ever-accelerating pace of technological advancements. However, with this rapid evolution comes a pressing challenge: the need to create web API applications that are not only functional but also adaptable, maintainable, and scalable to meet the demands of users and businesses alike. This book will help you address this challenge head-on, equipping you with the knowledge and skills required to develop web API applications from scratch. By providing a deeper understanding of the various protocols implemented by ASP.NET Core, including RESTful, SignalR (WebSocket), gRPC, and GraphQL, supplemented by practical examples and optimization techniques, such as using middleware, testing, caching, and logging, this book offers invaluable insights for both newcomers as well as seasoned developers to meet modern web development requirements. Additionally, you'll discover how to use cloud platforms such as Azure and Azure DevOps to enhance the development and operational aspects of your application. By the end of the book, you'll be fully prepared to undertake enterprise-grade web API projects with confidence, harnessing the latest advancements in ASP.NET Core 8 to drive innovation. What you will learn Build a strong foundation in web API fundamentals Explore the ASP.NET Core 8 framework and other industry-standard libraries and tools for high-performance, scalable web APIs Apply essential software design patterns such as MVC, dependency injection, and the repository pattern Use Entity Framework Core for database operations and complex query creation Implement robust security measures to protect against malicious attacks and data breaches Deploy your application to the cloud using Azure and leverage Azure DevOps to implement CI/CD Who this book is for This book is for developers who want to learn how to build web APIs with ASP.NET Core and create flexible, maintainable, scalable applications with .NET platform. Basic knowledge of C#, .NET, and Git will assist with understanding the concepts more easily.
Contents:
Cover
Title Page
Copyright and credits
Contributors
Table of Contents
Preface
Chapter 1: Fundamentals of Web APIs
What is a web API?
What is a REST API?
The constraints of REST
A REST API example
Is my web API RESTful?
Designing a REST-based API
Identifying the resources
Defining the relationships between resources
Identifying operations
Designing the URL paths for resources
Mapping API operations to HTTP methods
Assigning response codes
Documenting the API
RPC and GraphQL APIs
What is an RPC-based API?
What is a GraphQL API?
Real-time APIs
The problem with API polling
What is a real-time API?
Which real-time communication technology is best for your application?
Summary
Chapter 2: Getting Started with ASP.NET Core Web APIs
Technical requirements
Setting up the development environment
Configuring VS Code
Checking the .NET SDK
Creating a simple REST web API project
Building and running the project
Building the project
Running the project
Changing the port number
Hot Reload
Testing the API endpoint
Swagger UI
Debugging
Understanding the MVC pattern
The model and the controller
Creating a new model and controller
Creating a service
Implementing a GET operation
Implementing a CREATE operation
Implementing an UPDATE operation
Dependency injection
Understanding DI
DI in ASP.NET Core
DI tips
Introduction to minimal APIs
Creating a simple endpoint
Using DI in minimal APIs
What is the difference between minimal APIs and controller-based APIs?
Chapter 3: ASP.NET Core Fundamentals (Part 1)
Routing
What is attribute routing?
Mapping HTTP methods to action methods
Route constraints
Binding source attributes
Configuration.
Using appsettings.json
Using the options pattern
Other configuration providers
Environments
Understanding the launchSettings.json file
Setting the environment
Understanding the priorities of configuration and environment variables
Checking the environment in the code
Chapter 4: ASP.NET Core Fundamentals (Part 2)
Logging
Using built-in logging providers
Logging levels
Logging parameters
Using third-party logging providers
Structured logging
What should/shouldn't we log?
Middleware
What is middleware?
Built-in middleware
Creating a custom middleware component
Chapter 5: Data Access in ASP.NET Core (Part 1: Entity Framework Core Fundamentals)
Why use ORM?
Configuring the DbContext class
Creating models
Creating and configuring the DbContext class
Creating the database
Adding seed data
Implementing CRUD controllers
Creating the controller
How controllers work
Basic LINQ queries
Querying the data
Filtering the data
Sorting and paging
Creating an entity
Updating an entity
Deleting an entity
Configuring the mapping between models and database
Mapping conventions
Data annotations
Fluent API
Separating the mapping configurations
Chapter 6: Data Access in ASP.NET Core (Part 2 - Entity Relationships)
Understanding one-to-many relationships
One-to-many configuration
One-to-many CRUD operations
Understanding one-to-one relationships
One-to-one configuration
One-to-one CRUD operations
Understanding many-to-many relationships
Many-to-many configuration
Many-to-many CRUD operations
Understanding owned entities
Chapter 7: Data Access in ASP.NET Core (Part 3: Tips)
Technical requirements.
Understanding DbContext pooling
Understanding the difference between tracking versus no-tracking queries
Understanding the difference between IQueryable and IEnumerable
Client evaluation versus server evaluation
Using raw SQL queries
FromSql() and FromSqlRaw()
SqlQuery() and SqlQueryRaw()
ExecuteSql() and ExecuteSqlRaw()
Using bulk operations
ExecuteUpdate()
ExecuteDelete()
Understanding concurrency conflicts
Native database-generated concurrency token
Application-managed concurrency token
Handling concurrency conflicts
Reverse engineering
Other ORM frameworks
Chapter 8: Security and Identity in ASP.NET Core
Getting started with authentication and authorization
Creating a sample project with authentication and authorization
Understanding the JWT token structure
Consuming the API
Configuring the Swagger UI to support authorization
Delving deeper into authorization
Role-based authorization
Claim-based authorization
Understanding the authorization process
Policy-based authorization
Managing users and roles
New Identity API endpoints in ASP.NET Core 8
Understanding OAuth 2.0 and OpenID Connect
What is OAuth 2.0?
What is OpenID Connect?
Integrating with other identity providers
Other security topics
Always use Hypertext Transfer Protocol Secure (HTTPS)
Using a strong password policy
Implementing two-factor authentication (2FA)
Implementing rate-limiting
Using model validation
Using parameterized queries
Using data protection
Keeping secrets safe
Keeping the framework up to date
Checking the Open Web Application Security Project (OWASP) Top 10
Chapter 9: Testing in ASP.NET Core (Part 1 - Unit Testing)
Introduction to testing in ASP.NET Core.
Writing unit tests
Preparing the sample application
Setting up the unit tests project
Writing unit tests without dependencies
Writing unit tests with dependencies
Using FluentAssertions to verify the test results
Testing the database access layer
How can we test the database access layer?
Creating a test fixture
Using the test fixture
Writing tests for methods that change the database
Parallelism of xUnit
Using the repository pattern
Testing the happy path and the sad path
Chapter 10: Testing in ASP.NET Core (Part 2 - Integration Testing)
Writing integration tests
Setting up the integration test project
Writing basic integration tests with WebApplicationFactory
Testing with a database context
Testing with mock services
Testing with authentication and authorization
Creating the test class
Testing the anonymous API endpoints
Testing the authorized API endpoints
Code coverage
Using data collectors
Generating a code coverage report
Chapter 11: Getting Started with gRPC
Recap of gRPC
Setting up a gRPC project
Creating a new gRPC project
Understanding the gRPC project structure
Creating protobuf messages
Defining a protobuf message
Understanding field numbers
Understanding the field types
Other .NET types
Creating a protobuf service
Defining a unary service
Creating a gRPC client
Defining a server streaming service
Defining a client streaming service
Defining a bidirectional streaming service
Consuming gRPC services in ASP.NET Core applications
Updating proto files
Further reading
Chapter 12: Getting Started with GraphQL
Recap of GraphQL.
Setting up a GraphQL API using HotChocolate
Adding mutations
Using variables in queries
Defining a GraphQL schema
Scalar types
Object types
Retrieving related objects using resolvers
Field resolvers
Resolver for a list of objects
Using data loaders
Batch data loader
Group data loader
Using the Service attribute
Understanding the lifetime of the injected services
Interface and union types
Interfaces
Union types
Filtering, sorting, and pagination
Filtering
Sorting
Pagination
Visualizing the GraphQL schema
Chapter 13: Getting Started with SignalR
Recap of real-time web APIs
Setting up SignalR
Building SignalR clients
Building a TypeScript client
Building a Blazor client
Using authentication and authorization in SignalR
Adding authentication and authorization to the SignalR server
Adding a login endpoint
Authenticating the TypeScript client
Authenticating the Blazor client
Managing users and groups
Managing events in SignalR
Sending a message to a specific user
Using strongly typed hubs
Joining groups
Sending a message to a group
Sending messages from other services
Configuring SignalR hubs and clients
Configuring SignalR hubs
HTTP configuration options
Automatically reconnecting
Scaling SignalR
Chapter 14: CI/CD for ASP.NET Core Using Azure Pipelines and GitHub Actions
Introduction to CI/CD
CI/CD concepts and terminologies
Understanding the importance of CI/CD
Containerizing ASP.NET Core applications using Docker
What is containerization?
Installing Docker
Understanding Dockerfiles
Building a Docker image
Running a Docker container.
CI/CD using Azure DevOps and Azure Pipelines.
Notes:
Description based on publisher supplied metadata and other sources.
Description based on print version record.
ISBN:
9781804612460
1804612464
OCLC:
1425800670

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Library Catalog Using Articles+ Library Account