ASP.NET Core 6 and Angular
eBook - ePub

ASP.NET Core 6 and Angular

Valerio De Sanctis

Share book
  1. 780 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

ASP.NET Core 6 and Angular

Valerio De Sanctis

Book details
Book preview
Table of contents
Citations

About This Book

Design, build and deploy robust web applications using ASP.NET 6, Angular 13, and Entity Framework CoreKey Features• The most up-to-date book that covers cutting-edge features released in ASP.NET Core 6 and Angular 13• Create a production-ready Single-Page Application (SPA) or Progressive Web Application (PWA)• Adopt a full-stack approach to handle data management, API documentation, Web APIs, end-to-end testing, security, and deploymentBook DescriptionEvery 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.What you will learn• Use the new Visual Studio Standalone TypeScript Angular template• Implement and consume a Web API interface with ASP.NET Core• Set up an SQL database server using a local instance or a cloud datastore• Perform C# and TypeScript debugging using Visual Studio 2022• Create TDD and BDD unit tests using xUnit, Jasmine, and Karma• Perform DBMS structured logging using providers such as SeriLog• Deploy web apps to Azure App Service using IIS, Kestrel, and NGINX• Learn to develop fast and flexible Web APIs using GraphQL• Add real-time capabilities to Angular apps with ASP.NET Core SignalRWho this book is forThis book is for experienced ASP.NET developers who already possess some familiarity with ASP.NET Core and Angular and are looking to learn how to use them effectively together.The fully documented code samples (also available on GitHub) and the step-by-step implementation tutorials make this book easy to follow.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is ASP.NET Core 6 and Angular an online PDF/ePUB?
Yes, you can access ASP.NET Core 6 and Angular by Valerio De Sanctis in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Lenguajes de programación. We have over one million books available in our catalogue for you to explore.

Information

Year
2022
ISBN
9781803233642

6

Fetching and Displaying Data

In the previous chapter, we created a new WorldCities solution containing a WorldCities project (our Angular app) and a WorldCitiesAPI project (our ASP.NET Web API) and made a considerable effort to empower the latter with a DBMS-based data provider, built upon Entity Framework Core using the Code-First approach. Now that we have data persistence, we’re ready to entrust our users with the ability to interact with our application; this means that we can switch to the Angular app and implement some much-needed stuff, such as the following:
  • Fetching data: Querying the data provider from the client side using HTTP requests and getting structured results back from the server side
  • Displaying data: Populating typical client-side components such as tables and lists, and thereby ensuring a good user experience for the end user
  • Adding countries to the loop: For the sake of simplicity, we’ll learn how to implement the fetch and display tasks by focusing on the City entity: in the last part of the chapter, we’ll use the knowledge gained to apply the same techniques to the Country entity as well
In this chapter, we’ll cover the fetch and display topics by adding several client-server interactions handled by standard HTTP request/response chains; it goes without saying that Angular will play a major role here, together with a couple of useful packages that will help us reach our goal.

Technical requirements

In this chapter, we’re going to need all the technical requirements listed in the previous chapters, plus the following external library:
  • System.Linq.Dynamic.Core (.NET Core NuGet package) for the WorldCitiesAPI ASP.NET app
As always, it’s advisable to avoid installing them straight away; we’re going to bring them in during this chapter to better contextualize their purpose within our project.
The code files for this chapter can be found at https://github.com/PacktPublishing/ASP.NET-Core-6-and-Angular/tree/master/Chapter_06/.

Fetching data

As we already know from Chapter 2, Getting Ready, reading data from the database is mostly a matter of having the Angular app (the front-end) send HTTP requests to the ASP.NET app (the back-end) and fetching the corresponding HTTP responses accordingly; these data transfers will be mostly implemented using JavaScript Object Notation (JSON), a lightweight data-interchange format that is natively supported by both frameworks.
In this section, we’ll mostly talk about HTTP requests and responses, see how we can fetch data from the ASP.NET app, and lay out some raw UI examples using Angular components that will be further refined throughout the next sections.
A...

Table of contents