Book Image

ASP.NET Core 6 and Angular - Fifth Edition

By : Valerio De Sanctis
Book Image

ASP.NET Core 6 and Angular - Fifth Edition

By: Valerio De Sanctis

Overview of this book

Every full-stack ninja needs the tools to operate on front-end and back-end application development. This web app development book takes a hands-on, project-based approach to provide you with all the tools and techniques that web developers need to create, debug, and deploy efficient web applications using ASP.NET Core and Angular. The fifth edition has been updated to cover advanced topics such as Minimal APIs, Web APIs with GraphQL, real-time updates with SignalR, and new features in .NET 6 and Angular 13. You begin by building a data model with Entity Framework Core, alongside utilizing the Entity Core Fluent API and EntityTypeConfiguration class. You'll learn how to fetch and display data and handle user input with Angular reactive forms and front-end and back-end validators for maximum effect. Later, you will perform advanced debugging and explore the unit testing features provided by xUnit.net (.NET 6) and Jasmine, as well as Karma for Angular. After adding authentication and authorization to your apps, you will explore progressive web applications, learning about their technical requirements, testing processes, and how to convert a standard web application to a PWA. By the end of this web development book, you will understand how to tie together the front-end and back-end to build and deploy secure and robust web applications.
Table of Contents (18 chapters)
16
Other Books You May Enjoy
17
Index

What this book covers

Chapter 1, Introducing ASP.NET and Angular, introduces some of the basic concepts of the frameworks that we are going to use throughout the book, as well as the various kinds of web applications that can be created (SPAs, PWAs, native web apps, and more).

Chapter 2, Getting Ready, explains how to create the ASP.NET Core projects that will be used for the rest of the book using the templates provided by Visual Studio for both the back-end (ASP.NET Core Web API) and the front-end (Standalone Angular App).

Chapter 3, Looking Around, is a detailed overview of the various back-end and front-end elements provided by the .NET Core and Angular template shipped with Visual Studio, backed up with some high-level explanations of how they can work together in a typical HTTP request-response cycle.

Chapter 4, Front-End and Back-End Interactions, provides a comprehensive tutorial for building a sample ASP.NET Core and Angular app that provides diagnostic info to the end user by querying health check middleware using a Bootstrap-based Angular client.

Chapter 5, Data Model with Entity Framework Core, constitutes a journey through Entity Framework Core and its capabilities as an Object-Relational Mapping (ORM) framework, from SQL database deployment (cloud-based and/or local instance) to data model design, including various techniques to read and write data from back-end controllers.

Chapter 6, Fetching and Displaying Data, covers how to expose Entity Framework Core data using the ASP.NET Core back-end web API, consume that data with Angular, and then show it to end users using the front-end UI.

Chapter 7, Forms and Data Validation, details how to implement the HTTP PUT and POST methods in back-end web APIs in order to perform insert and update operations with Angular, along with server-side and client-side data validation.

Chapter 8, Code Tweaks and Data Services, explores some useful refactoring and improvements to strengthen your app’s source code and includes an in-depth analysis of Angular’s data services to understand why and how to use them.

Chapter 9, Back-End and Front-End Debugging, looks at how to properly debug the back-end and front-end stacks of a typical web application using the various debugging tools provided by Visual Studio to their full extent.

Chapter 10, ASP.NET Core and Angular Unit Testing, comprises a detailed review of the Test-Driven Development (TDD) and Behavior-Driven Development (BDD) development practices and goes into how to define, implement, and perform back-end and front-end unit tests using xUnit, Jasmine, and Karma.

Chapter 11, Authentication and Authorization, gives you a high-level introduction to the concepts of authentication and authorization and presents a narrow lineup of some of the various techniques, methodologies, and approaches to properly implementing proprietary or third-party user identity systems. A practical example of a working ASP.NET Core and Angular authentication mechanism based upon ASP.NET Identity and IdentityServer4 is included.

Chapter 12, Progressive Web Apps, delves into how to convert an existing SPA into a PWA using service workers, manifest files, and offline caching features.

Chapter 13, Beyond REST – Web API with GraphQL, introduces the concept of the GraphQL query language, explains its pros and cons, and shows how to implement a GraphQL-based API using HotChocolate (for the back-end) and Apollo Angular (for the front-end).

Chapter 14, Real-Time Updates with SignalR, is dedicated to SignalR, a free and open-source library that can be used to send asynchronous notifications to client-side web applications, and explains how to implement it in ASP.NET Core and Angular.

Chapter 15, Windows, Linux, and Azure Deployment, teaches you how to deploy the ASP.NET and Angular apps created in the previous chapters and publish them in a cloud-based environment using a Windows Server 2019 or a Linux CentOS virtual machine, as well as covering Azure App Service deployment.