Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ASP.NET Core 8 and Angular

You're reading from   ASP.NET Core 8 and Angular Full-stack web development with ASP.NET Core 8 and Angular

Arrow left icon
Product type Paperback
Published in Feb 2024
Publisher Packt
ISBN-13 9781805129936
Length 804 pages
Edition 6th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Valerio De Sanctis Valerio De Sanctis
Author Profile Icon Valerio De Sanctis
Valerio De Sanctis
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Introducing ASP.NET and Angular 2. Getting Ready FREE CHAPTER 3. Looking Around 4. Front-End and Back-End Interactions 5. Data Model with Entity Framework Core 6. Fetching and Displaying Data 7. Forms and Data Validation 8. Code Tweaks and Data Services 9. Back-End and Front-End Debugging 10. ASP.NET Core and Angular Unit Testing 11. Authentication and Authorization 12. Progressive Web Apps 13. Beyond REST – Web API with GraphQL 14. Real-Time Updates with SignalR 15. Windows, Linux, and Azure Deployment 16. Other Books You May Enjoy
17. Index

Index

Symbols

80 and 443 TCP ports 707

firewalld 708

ufw 708

@angular/service-worker npm package 575

adding 577

#if preprocessor directives

reference link 437

.NET 151

.NET 5 7-9

.NET 6 9

features and improvements 9, 10

.NET 7 10

improvements 10, 11

.NET 8 11

download link 686

improvements and features 11

.NET console application, debugging using Visual Studio

reference link 423

.NET deployment modes 671

framework-dependent deployment (FDD) 671

framework-dependent executable (FDE) 671, 673

self-contained deployment (SCD) 671, 672

.NET SDK/.NET Runtime, installing on Ubuntu 22.04

reference link 704

RxJS Subject

reference link 358

/src/app/ folder 73

AppComponent 75

AppModule 73, 74

/src/ folder 73

.webmanifest MIME type

adding 697

A

access modifiers 401

AccountController 520, 521

ApiLoginResult 515, 516

implementing 514

JwtHandler 517, 518

JwtSettings 516, 517

LoginRequest 515

action methods

CitiesController, securing 534

CountriesController, securing 534

securing 533

SeedController, securing 534

Act phase 473, 474, 528

addDataListeners 649

Admin user 532

ahead-of-time (AOT) compilation 674

Angular 2, 12

GraphQL, adding to 625

selecting, reasons 23

upgrading/downgrading 68, 69

used, for building web application 2

Angular 2 13

Angular 2, improvements

Angular Mobile Toolkit (AMT) 14

command-line interface (CLI) 14

components 14

semantic versioning 14

server-side rendering (SSR) 14

TypeScript 14

Angular 4 15

improvements 15

Angular 5 15

features 15

Angular 6 16

Angular 7 16

features 16, 17

Angular 8 17, 18

improvements and features 17

Angular 9 18, 19

features 18

Angular 10 19

Angular 11 20

features 20

Angular 12 20

improvements 20, 21

Angular 13 21

Angular 14 21

Angular 15 22

Angular 16 22

Angular 17 22

features 22

Angular app

AppComponent, updating 87-90

AppRoutingModule, updating 90, 91

building 708, 709

FetchDataComponent, adding 85

HomeComponent, adding 84

HomeComponent, modifying 91, 92

navigation menu, adding 85-87

publishing 732, 733

refactoring 83

test files of AppComponent, updating 90

test, running 92, 93

updating 143, 144

Angular app component

adding 122

AppRoutingModule 122

NavMenuComponent 123

testing 123, 124

Angular app, updating

angular-material.module.ts 261

cities.component.html 263-265

cities.component.ts 261-263

performing 261

Angular architecture

reference link 113

Angular CLI 39

Angular code

upgrading 71

Angular component 109, 282, 283

AppModule 287

AppRoutingModule 287

countries.component.html 285, 286

countries.component.scss 286

CountriesComponent, testing 288, 289

countries.component.ts 283-285

country.ts 283

creating 110

health-check.component.css 120, 121

health-check.component.html 119, 120

NavComponent 287

styling 121, 122

Angular component files

.css file 109

.html file 109

.spec.ts file 109

.ts file 109

health-check.component.ts 110, 111

Angular deployment tips 673, 674

angular.json configuration file(s) 676

automatic deployment 676, 677

differential loading 675, 676

environment.ts file(s), updating 676

ng build 674, 675

ng serve 674, 675

package.json file 674, 675

Angular form debugging 441

activity log 445, 446

activity log, extending 447, 448

activity log, testing 447

Form Model, viewing 441-443

pipe operator 444

user, reacting to changes 444

Angular forms 295, 296

exploring 294

Angular front-end 66

/src/ folder 73

root files 66, 67

test, running 77-79

Angular health checks 110

Angular component, creating 110

Angular initialization cycle 74

Angular.io

reference link 118

AngularJS 12

cache-friendly 13

dependency injection 13

directives 13

single-page approach 13

two-way data binding 13

angular.json file

updating 577

Angular Language Service

reference link 17

Angular Live Development Server 50

Angular Material 125

AngularMaterialModule, adding 233, 234

data, serving with 232

filtering, adding 265

installing 125, 126

MatTable 234

pagination, adding with MatPaginatorModule 237

reference link 126

sorting, adding with MatSortModule 251

AngularMaterialModule

adding 233, 234

updating 234, 235

Angular Material select 324-326

Angular packages 68

upgrading/downgrading 69, 70

Angular PNG icon set 586

Angular project

creating 40-44

Angular test suite 483

cities tests, creating 491, 492

describe and beforeEach sections 484-486

executing 492-495

fixture and component, configuring 489, 490

import section 484

mock CityService, adding 486

mock CityService, implementing 487-489

title test, creating 490

Angular unit tests 481, 482

general concepts 482

suite 483

TestBed interface 482

testing, with Jasmine 483

anonymous types

versus DTO classes 384, 385

API endpoints

modifying 80-82

api/heartbeat endpoint

adding 593

Minimal APIs 594

ApiResult

extending 251-255

Apollo Angular 625

installing 625-627

AppComponent 75

app.component.html 591, 592

app.component.scss 592, 593

app.component.ts 590, 591

files 75

HTML template file 77

spec.ts file 77

StyleSheet file 77

TypeScript class file 75, 76

updating 590

application logging 456, 457

application programming interfaces (APIs) 2

AppModule 73, 74

AppModule file

updating 589

AppRoutingModule 122

App Service

apps, adapting for 731, 732

apps, publishing to 732

App Service instances

creating 727

App Service Managed Certificate 663

appsettings.Development.json file 61

appsettings.json file 60

updating 193

appsettings.Production.json file(s)

HealthCheck.Server 669, 670

updating 669

WorldCities.Server 670, 671

app trimming feature 672

Arrange, Act, Assert pattern 471

Arrange phase 472, 473, 528

ASP.NET 279

CountriesController 279, 280

used, for building web application 2

ASP.NET 5 3

reference link 9

ASP.NET back-end 56

configuration files 57

controllers 61, 62

OpenAPI (Swagger) 63-66

ASP.NET Core

GraphQL, adding to 614

selecting, reasons 23

ASP.NET Core 1.x 3, 4

ASP.NET Core 2.1

references 4

ASP.NET Core 2.2

references 5

ASP.NET Core 2.x 4, 5

ASP.NET Core 3.0

references 6

ASP.NET Core 3.1

reference link 7

ASP.NET Core 3.x 5, 6

ASP.NET Core app

updating 143

ASP.NET Core, configuring to work with proxy servers and load balancers

reference link 709

ASP.NET Core deployment tips 663

launchSettings.json file 663, 664

runtime environments 665

ASP.NET Core fundamentals overview

reference link 58

ASP.NET Core health checks 98

HealthChecks middleware, adding 98, 99

Internet Control Message Protocol (ICMP) request check, adding 99, 100

ASP.NET Core, hosting on Linux with Nginx

reference link 706

ASP.NET Core, hosting on Windows with IIS

reference link 696

ASP.NET Core Identity

AccountController, implementing 514

action methods, securing 533

ApplicationDbContext, extending 512, 513

ApplicationUser, creating 512

configuring 513, 514

JwtBearerMiddleware, configuring 521, 522

NuGet packages, adding 511, 512

SeedController, updating 522

setting up 511

ASP.NET Core Identity APIs

reference link 508

ASP.NET Core Identity model 510

entity types 510, 511

ASP.NET Core Identity system 508

ASP.NET Core logging 457

ASP.NET Core project

publishing 733-735

ASP.NET Core revolution 2

ASP.NET Core Runtime 686

installing 704, 705

Microsoft signing key and repository, downloading 705

ASP.NET Core Runtime installation

IIS service, restarting 687

ASP.NET Core Server 49

ASP.NET Core SignalR 639

ASP.NET Core solution

overview 56

ASP.NET Core unit tests 466

Act phase 473, 474

Arrange phase 472, 473

Assert phase 474

behavior-driven development 479-481

debugging 476-478

executing 474

executing, with CLI 474, 475

executing, with Visual Studio Test Explorer 475, 476

first test, creating 470-472

test-driven development 478, 479

WorldCities.Server.Tests project, creating 466, 467

ASP.NET Core Windows hosting bundle

installing 686, 687

assembly linker 672

Assert phase 474, 528

Asynchronous JavaScript + XML (AJAX) 29, 395

Asynchronous programming scenarios

reference link 536

async tasks 535, 536

async validators 328

authentication 497, 499

third-party authentication 504

authentication, in Angular

AuthService, implementing 542, 543

HttpInterceptors 555

implementing 541

LoginComponent, creating 544

LoginRequest interface adding 542

LoginResult interface, adding 542

Route Guards 558, 559

authentication methods 499

signatures 503

tokens 501, 502

Two-Factor Authentication (2FA) 503

AuthGuard

implementing 560, 561

testing 562

authorization 497, 505

proprietary authorization 505

third-party authorization 506

AuthService

implementing 542, 543

authStatus observable

creating 550, 551

testing 554, 555

UI, updating 551

awaits 535, 536

Azure Active Directory 507

Azure App Service deployment 727

Azure Bastion documentation

reference link 683

Azure Data Studio 183

download link 173

Azure Spot feature

reference link 681

Azure SQL

reference link 174

Azure SQL Database for free

reference link 181

Azure SQL Managed Instance

reference link 174

Azure tenant 177

Azure Virtual Machine publish profile 690, 691

Azure Web Apps deployment options

reference link 734

B

backend debugging 422

basics 423

conditional breakpoint 423, 424

Entity Framework (EF) Core 432, 433

working, on Windows/Linux 422, 423

backend server, proxying

reference link 81

Banana Cake Pop (BCP) 622

BaseFormComponent

implementing 367, 368

baseUrl property

adding 83

environment files, generating 82

implementing 82

behavior-driven development (BDD) 465, 479-481

Blazor render modes

reference link 11

broadcast message

adding 644

controller, using 645

Minimal API, using 645

browser developer tools 439-441

bugs 421

bundling 674

C

C# 10 features

reference link 10

Cache, configuring

reference link 628

calls, debouncing to back-end 357

CitiesComponent, updating 357-359

CountriesComponent, updating 359

child class 367

CitiesComponent

updating 235-237

Cities, list 226

[hidden] attribute 229

app-routing.module.ts 230, 231

cities.component.html 228

cities.component.scss 230

cities.component.ts 227, 228

city.ts 227

nav-component.html 231, 232

city

Add a new City button, adding 316

adding 312

CityEditComponent, extending 313-316

route, adding for Add a new City button 317-319

CityEditComponent

extending 370, 371

CityEditComponent, Reactive Forms 302, 303

city-edit.component.html 307-309

city-edit.component.scss 309

city-edit.component.ts 304-307

CityService

Angular app, using 632-634

mutation, querying 634-636

refactoring 628-630

class inheritance 366, 367

CLI

used, for executing test 474

client-initiated events 653

feature, testing 656

HealthCheckComponent, updating 655

HealthCheckHub, updating 653

HealthCheckService, updating 654

client-side debugging 448, 449

client-side paging 238-241

client-side validation 333

code

debouncing 356

throttling 356

code bloat 364

Code-First approach 155

cons 156

pros 156

used, for creating database 187

Common Language Runtime (CLR) 511

Component Dev Kit (CDK) 125

components 75

conditional breakpoint 423, 424

Actions feature 425, 426

Conditions checkbox 425

setting, options 424

testing 426, 427

configuration files 57

appsettings.json 60

Program.cs 57-60

connection string

securing 194

console applications 456

constructor 116

Content Delivery Network (CDN) 81, 668

content management systems (CMSes) 29

continuous integration and continuous delivery (CI/CD) 690

Continuous Integration (CI) 149

controllers 61, 62

CORS policy 595

countries, adding to loop 279

Angular 282

ASP.NET 279

CountriesController 279, 280

odd JSON naming issue 280-282

CountryEditComponent

AppRoutingModule 350

CountriesComponent 351

country-edit.component.html 348-350

country-edit.component.scss 350

country-edit.component.ts 341-345

creating 341

extending 369, 370

IsDupeField server-side API 346, 347

isDupeField validator 346

testing 352-355

CountryService

refactoring 636

C# preprocessor directives

reference link 165, 437

CreateDefaultUsers() unit test

defining 524

IdentityHelper static class, adding 524-526

SeedController_Test class, adding 526-529

Create, Read, Update, and Delete (CRUD) 148, 499

Cross-Origin Resource Sharing (CORS) 594-596

AllowedCORS configuration setting, adding 596

implementing 596

Program.cs file, updating 597

CSS

replacing, with Sass 133, 134

CSS code sample 130, 131

CSS history 130

custom async validator

reference link 336

C# version 9

reference link 9

D

data

fetching 224

Data Annotations 162, 188

database

autogenerated database tables, checking 204

configuring 183, 184

creating 199

creating, with Code-First approach 187

data, seeding 539-541

dotnet CLI, using 200

Excel file, importing 207-214

identity migration, adding 537

initial migration, adding 200

login, mapping to 186, 187

migration, applying to 537

migrations 205

Package Manager Console, using 203, 204

populating 205, 206

Program.cs, updating 199, 200

SeedController, implementing 206, 207

updating 536, 537

WorldCities database, creating 184, 185

Database-as-a-Service (DBaaS) approach 173

database connection string

checking 710, 711

Database-First approach 156

cons 157

pros 157

database initialization strategies 192, 193

database initializers/DbInitializers 192

Database Management System (DBMS) 141

database management tool(s)

installing 173

database schema (DB schema) 539

database table names

defining 169

data interchange format 641

data migration 205

data model 151

DataModel 300

data modeling approaches 155

Code-First approach 155, 156

Database-First approach 156, 157

options, selecting 158

data seeding

reference link 206

data seeding strategy 206

data server

using, reasons 148, 149

data services 394

building 399

Fetch 396, 397

HttpClient 397, 398

XMLHttpRequest 394-396

data source 149, 150

Data Transfer Object (DTO) 216, 380

data validation 326, 327

model-driven validation 328

server-side validation 333-335

template-driven validation 327, 328

DbContext

setting up 187, 188

DbExtensions.AsNoTracking Method

reference link 213

DBMS licensing models 154

Developer edition 154

Evaluation edition 154

Express edition 154

DBMS structured logging, with Serilog 458

HTTP requests, logging 460

logs, accessing 460-462

NuGet packages, installing 458

Serilog, configuring 458-460

dead code purging 675

deadlocks 535, 536

debounceTime

reference link 359

debouncing 356

Debug built-in provider 457

debugger 421

debugging 421

dependency injection (DI) 113, 114, 511

deprecated APIs and features

reference link 18

desktop applications 456

development environment 665

differential loading 675, 676

Digital Equipment Corporation (DEC) 19

DI in Angular

reference link 114

DI in ASP.NET Core

reference link 114

DI registration options 519, 520

Document Object Model (DOM) 115, 229

Don’t Repeat Yourself (DRY) principle 364

dotnet CLI

database, updating 201, 202

No executable found matching command dotnet-ef error 202

System.Globalization.CultureNotFoundException error 203

using 200

dotnet-ef console commands 539

dragon-breath 12

DTO classes 383, 384

security considerations 384

separation of concerns 384

versus anonymous types 384, 385

DupeCityValidator, server-side validation 335

CitiesController 337

city-edit.component.html 337, 338

city-edit.component.ts 335, 336

Observable methods 339, 340

performance issues 340

RxJS operators 339, 340

testing 338, 339

E

eager loading 168

ECMAScript 2022 675

edge-origin proxy 716

EF Core .NET CLI

reference link 204

EF Core PMC / PowerShell

reference link 204

Elvis operator 331

endpoints

alternatives 662, 663

configuring 660, 661

HOSTS file, tweaking 661, 662

end-to-end (E2E) web development tool 12

entities

#region blocks, using 164-166

City entity 160-163

Country entity 163, 164

creating 158

defining 159, 160

securing 386

entity controllers 214

CitiesController 215, 216

CountriesController 216

testing 217, 218

usage, considering 216

Entity Data Model (EDM) 151

Entity Framework 7 151

Entity Framework Core Database Providers list 152

Entity Framework Core (EF Core) 151, 152, 377

debugging 432, 433

installing 152, 153

reference link 205, 617

Entity Framework Core loading pattern 168

entity type configuration methods 188

Data Annotations 188

EntityTypeConfiguration classes 188-191

Fluent API 188-190

options, selecting 192

entity types 510, 511

error handling in ASP.NET Core

reference link 667

error handling techniques 666, 667

Excel file

importing 207-214

explicit loading 168

F

favicon

adding 583, 584

download link 583

favicon online generators

references 583

feature modules 74

Fetch 394-397

advantages 398

files

deploying, to Linux VM 711, 712

FileZilla

URL 712

FileZilla FTP Server

reference link 689

filter behavior

debouncing 356

improving 355

throttling 356

filtering

adding 265

AngularMaterialModule 276-278

ApiResult, extending 266-272

CitiesComponent 273-275

CitiesComponent style (SCSS) file 276

CitiesComponent template (HTML) file 275

CitiesController 272, 273

performance considerations 278

reference link 617

Fluent API 188-190

Folder publish profile

creating 688

FormBuilder 340

CountryEditComponent, creating 341

CountryEditComponent, testing 352-355

forms

using, reasons 296, 297

Forwarded Headers Middleware 709

adding 710

framework-dependent deployment (FDD) 671

advantages 671

disadvantages 672

framework-dependent executable (FDE) 671, 673

advantages 673

disadvantages 673

frontend debugging 437

Angular form debugging 441

browser developer tools 439-441

client-side debugging 448, 449

Observables, unsubscribing 449

Visual Studio JavaScript debugging 437, 438

FTP publish profile 689, 690

Full Database Backup

reference link 538

full-stack approach 28

G

General Data Protection Regulation (GDPR) 4

generic types 403

GetAngular 12

GetCountries() SQL query 433, 434

#if preprocessor directive, using 436, 437

SQL code, obtaining programmatically 434, 435

ToParametrizedSql() method, implementing 435, 436

globalization-invariant mode

reference link 203

Google identity provider 504

GraphQL 607, 612

adding, to Angular 625

adding, to ASP.NET Core 614

advantages over REST 612, 613

CityService, refactoring 628-630

CountryService, refactoring 636

disadvantages 613

implementing 613

versus REST 608

GraphQL Cursor Connections Specification

reference link 630

GraphQLModule

updating 627

GraphQL query

improving 631, 632

GraphQL schema

testing 622-625

H

healthcheck.client

publishing 687

testing 698, 736, 737

healthcheck.client app 482

healthcheck.client Static Web App

adding 728-730

health-check.component.css 120, 121

health-check.component.ts 110, 111

constructor 116

dependency injection (DI) 113, 114

HttpClient 117

imports and modules 112

interfaces 118, 119

ngOnInit method 114, 115

observables 118

HealthCheck (HC) 580

health check responses 108

HealthCheck.Server

publishing 687

testing 698, 736, 737

HealthCheck.Server App Service

adding 730, 731

HealthCheck web application

testing 698, 699

HomeComponent, Angular app

dry run switch 84

spec.ts file, skipping 85

HOSTS file

tweaking 661, 662

HotChocolate

installing 614

mutation 615, 617-621

Program.cs 621, 622

query 615

Serial attribute 616

subscription 615

UseFiltering attribute 616

UsePaging attribute 616

UseSorting attribute 616

HTML Living Standard 229

HTML select 319-324

HTTP/1.1 protocol

reference link 608

HttpClient 117, 397, 398

advantages 398

HTTP/HTTPS implementation standards 499

HttpInterceptors 556, 574

AppModule, updating 558

AuthInterceptor, implementing 556, 557

reference link 556

testing 558

HTTP port

setting up 45, 46

HTTP requests 224

logging 460

HTTP responses 224

HTTPS port

setting up 45, 46

HTTP status codes 108

HTTP Strict Transport Security (HSTS) 667

I

ICMPHealthCheck class

custom output message, implementing 106, 107

improving 104

middleware setup, updating 105, 106

output message, configuring 108

parameters and response messages, adding 104, 105

Identity API endpoints 508, 563

activating 563, 564

disadvantages 566, 567

testing 564-566

identity migration

adding 537

IdentityServer

reference link 508

IIS application pool

configuring 695, 696

IIS Manager tool 697

indexes

defining 169, 170

index.html file

updating 578

Infrastructure as a Service (IaaS) 170

inheritance 367

in-memory Web API package 148

Interactive Automatic rendering (IAR) 11

Interactive Server rendering (ISR) 11

Interactive WebAssembly rendering (CSR) 11

interfaces 118, 119

internal membership provider 507

International Organization for Standardization (ISO) 164

Internet Control Message Protocol (ICMP) request check 99

ICMPHealthCheck class, creating 100-102

ICMPHealthCheck middleware, adding 102, 103

outcomes 100

Internet Information Services (IIS)

configuring 691

healthcheck.client website entry, adding 691-693

HealthCheck.Server website entry, adding 693

reference link 684

TLS/SSL certificates 693, 694

Inversion of Control (IoC) 114, 519

ISO 3166 164

references 164

ISO 3166-1 alpha-2 164

reference link 164

ISO 3166-1 alpha-3 164

reference link 164

ISO 3166-1 numeric 164

J

Jasmine 481

testing with 483

Jasmine testing framework 465

JavaScript approaches

downsides 588

JavaScript Library Usage Distribution

references 12

JavaScript Object Notation (JSON) 224

conventions 225, 226

defaults 226

JavaScript source maps 439

journalctl

reference link 720

JSON Web Tokens (JWTs) 499, 509

URL 509

Just-In-Time (JIT) compiler 10, 674

just-in-time (JIT) VM access

reference link 683

K

Karma 68, 481

Kestrel

configuring 715, 716

kitchen sink 389

L

launchSettings.json file 663, 664

lazy loading 168

Let’s Encrypt 573

reference link 663

LGPL to Polyform Noncommercial

reference link 208

LINQ 256, 257

Linq.Dynamic

alternative approach with 347, 348

Linux 154

Linux deployment 699

Linux VM

/var/www folder, creating 712

app, deploying with WinSCP 713

configuring 702

files, deploying to 711, 712

permissions, publishing 713

permissions, setting 712, 713

WorldCities publish folders, copying 714, 715

Linux VM on MS Azure

creating 700

DNS name label, adding 701

inbound security rules, setting 702

Linux VM, adding 700, 701

LiteXHealthChecks 137

Loading Related Data

reference link 169

local area network (LAN) 100

login

mapping, to database 186, 187

LoginComponent

AppRoutingModule, updating 547

creating 544

login.component.html 545-547

login.component.scss 547

login.component.ts 544, 545

NavMenuComponent, updating 547

testing 548, 549

LoginRequest interface

adding 542

LoginResult interface

adding 542

logs

accessing 460-462

M

managed cloud database

reference link 174

master/detail UI pattern 302

mat-error default behavior

reference link 330

MatPaginatorModule

pagination, adding with 237

MatTable 234

MatTable component 136

MatToolbar

adding 127

AppModule, updating 127

NavMenuComponent HTML template, updating 127, 128

test run 128, 129

Microsoft signing key and repository

downloading 705

Microsoft XML Core Services (MSXML) library 395

migration

applying, to database 537

data model, dropping 539

data model, recreating 539

existing data model, updating 538, 539

reference link 537

minification 439, 675

Minimal APIs 594

minimisation/minimization 439

mock CityService

adding 486, 487

alternative implementation, using interface approach 489

extending and overriding 487

fake service class 487

implementing 487-489

interface instance 487

spy 487

mocking 468

Model 384

ModelBuilder API 188

Model, creating and configuring

reference link 163

model-driven forms 298-301

model-driven validation 328

safe navigation operator 331

validators, adding in form 328-331

validators, testing 331, 332

model scaffolding 156

Model-View-ViewModel (MVVM) 384

module resolution

reference link 112

Moq 468, 469

multi-page applications (MPAs) 28, 29

Multi-platform Application UI (MAUI) 9

multiple projects

secrets.json file, sharing between 197, 198

MVC6 3

N

N+1 problem 611

native web applications (NWAs) 28, 32

navigation link

adding 309

app-routing.module.ts 310

cities.component.html 310-312

navigator.onLine property 587

JavaScript approaches, downsides 588

NavMenuComponent 123

ng-connection-service npm package 588

AppComponent, updating 590

AppModule file, updating 589

service, installing 589

Nginx

configuring 715, 716

configuring, for worldcities.client 722, 723

configuring, for WorldCities.Server 721, 722

HTTP connection, checking 706, 707

installing 705

starting up 706

nginx.conf file

updating 723, 724

NgModules 73, 74

reference link 113

ngOnInit method 114, 115

ngsw-config.json file

adding 584, 585

Node.js 68

Node Package Manager (npm) configuration file 67, 78

non-development environment 666

npmJS syntax 68

Nsubstitute NuGet package 468

NuGet packages

installing 458

O

OAuth 2 506

OAuth-based social login 504

Object-Oriented Programming (OOP) 367, 465

Object Relational Mapper (ORM) 151

Observables 118

alternatives methods, for unsubscribing 452-454

takeUntil() operator 451, 452

unsubscribe, determining 455

unsubscribe() method 449, 450

unsubscribing 449

offline loading 574

offline mode 574

on-demand caching strategy 585

On-stack Replacement (OSR) 10

OpenAPI 63-66

OpenAPI Specification (OAS) 63

OpenID 504

working 504

OpenID Connect (OIDC) 504, 505

references 505

OpenSSL tool

reference link 717

Open Web Application Security Project (OWASP) 668

Oracle XE 158

Outlook Web Access (OWA) 394

output window, backend debugging 427, 428

configuring 432

LogLevel, testing 429-432

LogLevel types 428, 429

over-fetching 611

P

package.json

reference link 68

Package Manager Console 256

pagination

adding, with MatPaginatorModule 237

client-side paging 238-241

reference link 617

server-side paging 241

PING 99

pipes, using to transform data

reference link 444

Platform as a Service (PaaS) 170

polyfills 675

PolyForm Noncommercial License 1.0.0

reference link 208

polymorphism 367

production

app, preparing 660

production environments 665

production mode 674

product owner expectations 32, 33

adaptability 34

early releases 33

fast completion 33

GUI over back-end 33

product repository

registering 705

Program.cs file 57-60

Progressive Web Apps (PWAs) 28, 30, 571

capabilities, testing 598

distinctive features 572, 573

installing 602, 603

offline status, handling 587

technical baseline criteria 31

technical features 30

testing out 599-602

Progressive Web Apps (PWAs), capabilities

app, compiling 598

http-server, installing 598, 599

Progressive Web Apps (PWAs), distinctive features

@angular/service-worker 575

offline loading 574

secure origin feature, implementing 573

service workers versus HttpInterceptors 574

proprietary

versus third-party providers 506, 507

proprietary authorization 505

Proprietary auth with ASP.NET Core 507-509

Protractor 481

PuTTY 702

URL 702

PWA, offline status

api/heartbeat endpoint, adding 593

Cross-Origin Resource Sharing (CORS) 594-596

navigator.onLine property 587

ng-connection-service npm package 588

window’s ononline/onoffline event 587

PWA requirements

automatic installation 585, 586

implementing 576

manual installation 576

PWA requirements, automatic installation

Angular PNG icon set 586

PWA requirements, manual installation

@angular/service-worker npm package, adding 577

angular.json file, updating 577

favicon, adding 583, 584

index.html file, updating 578

ngsw-config.json file, adding 584, 585

ServiceWorkerModule, importing 578

Web App Manifest file, adding 579-582

R

Reactive Extensions for JavaScript (RxJS) library 118, 396

reference link 118

Reactive Forms 298, 301

building 301

navigation link, adding 309

ReactiveFormsModule 302

reference link 301

real-time HTTP 640, 641

RED-GREEN-REFACTOR 479

RegExr

URL 345

regression bugs 611

relationships

Cities property, adding to Country entity class 167

Country property, adding to City entity class 166, 167

defining 166

Representational State Transfer (REST) 607-609

constraints, guiding 609, 610

drawbacks 610, 611

versus GraphQL 608

required modifier

reference link 162

Response Time values 653, 656

RESTful 610

root files 66, 67

angular.json 67

package.json 67, 68

tsconfig.json 71

workspace-level files 72

root module 74

Roslyn 3

Route Guards 558, 559

AppRoutingModule, updating 561

AuthGuard, implementing 560, 561

availability in Angular 559, 560

runtime environments 665

appsettings.Production.json file(s), updating 669

environment, setting in production 669

error handling techniques 666, 667

rule(s) of thumb 668, 669

S

safe navigation operator 331

reference link 331

Safe storage of app secrets in development in ASP.NET Core

reference link 195

same-origin policy 595

SameSite cookie specification 501

Sass 129, 130

CSS code sample 130, 131

CSS history 130

need for 131, 132

SCP, using to move files to and from VM

reference link 702

Scrum

reference link 34

secrets.json file

adding 195-197

sharing, between multiple projects 197, 198

working with 198, 199

Secrets Storage 195

Secure Copy (SCP) 702

secure origin feature

implementing 573

Security-Enhanced Linux (SELinux) 717

references 717

SeedController

CreateDefaultUsers() method, implementing 529-532

CreateDefaultUsers() unit test, defining 524

implementing 206, 207

RoleManager, adding through DI 522

unit test, rerunning 532, 533

updating 522

UserManager, adding through DI 522, 523

self-contained deployment (SCD) 671, 672

advantages 672

disadvantages 672

self-signed SSL certificate

creating 694, 695, 716

SELinux-protected kernels

task for 717

semantic versioning (SemVer) 14

Separation of Concerns (SoC) 130, 384

Serilog

configuring 458-460

reference link 462

server push 640, 641

server-side paging 241

ApiResult 243-247

CitiesComponent 247-250

CitiesController 241, 242

server-side validation 333-335

ServiceWorkerModule

importing 578

Session-Based Authentication Flow 500

session cookies

disadvantages 500, 501

SignalR 641

connections 642

disadvantages 643

groups 642

Hubs 641

implementing 642

projects, testing 652, 653

protocols 641

tasks, to achieve result 643

user 642

SignalR, in Angular

health-check.component.html 651, 652

HealthCheckComponent, refactoring 650

health-check.component.ts 650, 651

HealthCheckService, implementing 647-649

installing 646

npm package, adding 646

WebSocket support, adding to Angular proxy 649, 650

SignalR, in ASP.NET Core

broadcast message, adding 644

HealthCheckHub, creating 643

middleware, setting up 644

services, setting up 644

setting up 643

signature-based authentication 503

Single-Page Application (SPA) 28, 29, 117, 499, 571

key features 30

Single Responsibility Principle (SRP) 389

sorting

adding 251

reference link 617

sorting, with MatSortModule 251

Angular app, updating 261

ApiResult, extending 251, 255

CitiesController, updating 260, 261

System.Linq.Dynamic.Core, installing 256

Source Code Management (SCM) 35

source IP address 683

SPA project

example 34, 35

SQL database 173, 174

setting up 174-177

WorldCities login, adding 185

SQL Database instance

configuring 178-182

SQL database on Azure

creating 173

SQL injection

preventing 258, 259

SQL Managed Instance 173, 174

SQL Server

download link 171

SQL Server 2022

installing 171-173

SQL Server alternatives 154

SQL Server Data Provider 153

DBMS licensing models 154

for Linux 154

SQL Server Express 171

SQL Server instance

database management tool(s), installing 173

obtaining 170, 171

SQL Server Linux installation guide

reference link 711

SQL Server Management Studio (SSMS) 172, 183, 538

download link 173

SQL Server on Linux

installation link 172

SQL Server on Windows

installation link 172

SQL Server on Windows virtual machine

reference link 174

SQL virtual machine 174

SSH 702

SSH access 573

SSL folder permissions

setting 717

Stack Overflow

reference link 60

staging 665

staging environment 668

standard testing development (STD) 470

startConnection 649

startup project

setting up 46-48

Static Server rendering (SSR) 11

static web apps

reference link 730

StyleCop 165

subclass 367

Swagger 59, 63

Swashbuckle 64

Swashbuckle.AspNetCore NuGet package 64

Swashbuckle.AspNetCore.Swagger 64

Swashbuckle.AspNetCore.SwaggerGen 64

Swashbuckle.AspNetCore.SwaggerUI 64

Swiss Army knives

downsides 388, 389

sync validators 328

systemd service

configuring 718-720

System.Linq.Dynamic.Core

benefits 257

drawbacks 257

installing 256

T

tables

restyling 135, 136

template-driven forms 297-300

advantages 298

disadvantages 298

reference link 298

template-driven validation 327, 328

reference link 328

temporal domination 12

TestBed interface 482

Test-Driven Development (TDD) 465, 478, 479, 524, 668

test run

performing 48

troubleshooting 51

third-party authentication 504

OpenID 504

OpenID Connect (OIDC) 504, 505

OpenID, working 504

third-party authorization 506

third-party providers

versus proprietary 506, 507

throttleTime

reference link 359

throttling 356, 359

Time-Based One-Time Password (TOTP) algorithm 503

reference link 503

TLS/SSL certificates 693, 694

TLS/SSL certificates in Azure App Service

reference link 663

token-based authentication 501, 502

tree-shaking

reference link 20

tsconfig.json file structure

reference link 20

Two-Factor Authentication (2FA) 503

reference link 503

TypeScript 66

TypeScript 3.7

reference link 331

TypeScript compiler (TSC) 71

TypeScript configuration

reference link 72

TypeScript modules

reference link 112

type variables 403

U

uglification 675

UI, authStatus observable

AppComponent 554

NavMenuComponent 552, 553

updating 551

UI component framework

Angular Material 125

MatToolbar, adding 127

restyling 124

Sass 129

unauthorized access prevention

reference link 560

unit testing 465

Unsubscribe RxJS Observables In Angular Applications

reference link 455

updateData 649

up-front caching strategy 585

user experience (UX) 574

user interface (UI) 456

V

validators

reference link 329

variable scoping 114

ViewModel 384

virtual machine (VM)

connecting to 703, 704

Visual Studio JavaScript debugging 437, 438

Visual Studio publish profiles 688

Visual Studio Test Explorer

used, for executing test 475, 476

W

waterfall model

reference link 34

WeatherForecastController 62, 63

Web API backend for SPAs, securing

reference link 566

web app 456

serving, avoidance with Kestrel directly 720, 721

web application project

.NET 8 SDK, installing 38

Angular CLI, installing 39

Angular project, creating 39

architecture overview 51, 52

ASP.NET Core project, creating 39

broken code 36

Node.js, installing 39

problem solving 37

SDK version, checking 39

setting up 37, 38

test run, performing 48

Web App Manifest file

adding 579-582

publishing 582

web browser 50, 51

web server 300, 301

wide area network (WAN) 100

Windows deployment 677

Windows Firewall, configuring to allow SQL Server access

reference link 711

Windows HOSTS file

reference link 661

window’s ononline/onoffline event 587

Windows Presentation Foundation (WPF) 5

Windows Server VM on MS Azure

creating 677

DNS name label, configuring 682

inbound security rules, setting 682, 683

MS Azure portal, accessing 677

Windows VM, adding 678-681

Windows VM

ASP.NET Core Windows hosting bundle, installing 686, 687

configuring 683, 684

IIS web server, adding 684-686

WinSCP

reference link 712

workspace API 67

WorldCities

testing 724, 725

troubleshooting 726

worldcities.client

Nginx, configuring for 722, 723

publishing 708

worldcities.client app 482

WorldCities database

creating 184, 185

WorldCities login

adding 185

raw SQL commands, using 185

SSMS GUI, using 185

WorldCities.Server

Nginx, configuring for 721, 722

publishing 708

testing 724, 725

troubleshooting 726

WorldCities.Server app

building 709

database connection string, checking 710, 711

Forwarded Headers Middleware, adding 710

WorldCities.Server project 149

WorldCities.Server.Tests project

creating 466, 467

dependency reference, adding 469

Microsoft.EntityFrameworkCore.InMemory 469

Moq 468, 469

WorldCities web application 142, 363

[JsonIgnore] attribute 386-388

[NotMapped] attribute 386-388

Angular app, updating 143, 144

Angular front-end updates 380-383, 391-393

AppModule 405, 406

ASP.NET Core app, updating 143

BaseFormComponent, implementing 367, 368

base-form.component.ts 373, 374

BaseService, creating 400, 401

bug fixes and improvements 371

CitiesComponent 406-408

CitiesController 390, 391

CityEditComponent 408, 409

CityEditComponent, extending 370, 371

city-edit.component.html 374-376

city-edit.component.ts 371-373

CityService, creating 403-405

CityService, implementing 405

common interface methods, adding 401, 402

CountriesComponent 414

CountriesController 377-379

CountryDTO class, creating 379, 380

CountryEditComponent 416-418

CountryEditComponent, extending 369, 370

country name, adding 390

CountryService, creating 412-414

data server, using reasons 148, 149

DTO classes 383, 384

form validation shortcuts 365, 366

lat and lon, validating 371

loadCountries and isDupeCity, implementing in CityService 410-412

minimal UI restyling 144-148

number of cities, adding 376, 377

template improvements 364

World Wide Web Consortium (W3C) 130, 395

World Wide Web (WWW) 497

X

XMLHttpRequest (XHR) 295, 394-396

xUnit.net testing tool 465

Y

Yarn 72

URL 72

Z

ZeroSSL

reference link 663

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application. 

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below:
Qr code

Description automatically generated

https://packt.link/free-ebook/9781805129936

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image