Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Blazor WebAssembly by Example
  • Table Of Contents Toc
Blazor WebAssembly by Example

Blazor WebAssembly by Example - Third Edition

By : Toi B. Wright
close
close
Blazor WebAssembly by Example

Blazor WebAssembly by Example

By: Toi B. Wright

Overview of this book

Blazor WebAssembly allows you to build web apps without the need for JavaScript, plugins, or add-ons. With its continued growth in popularity, Blazor WebAssembly can open doors to new career paths and exciting projects, and Blazor WebAssembly by Example makes getting started easy. This project-based guide teaches you how to build single-page web applications by focusing heavily on the practical over the theoretical. The author provides step-by-step instructions for each project as well as a video of her following those exact steps. In this updated edition, we've added two new chapters on integrating artificial intelligence into web apps built with Blazor WebAssembly. You'll start with simple standalone web apps and gradually progress to hosted web applications with SQL Server backends. Each project covers a different concept from the Blazor WebAssembly ecosystem, such as Razor components, JavaScript interop, security, events, debugging, state management, hosted applications, REST APIs, and AI. The book's projects get more challenging as you progress, but you don't have to complete them in order, which makes this book a valuable resource for beginners as well as those who just want to dip into specific topics. By the end of this book, you'll be building your own web apps with .NET and C# using Blazor WebAssembly.
Table of Contents (18 chapters)
close
close
15
Chapter 15: Unlock Access to the Code Bundle and the PDF Version
16
Other Books You May Enjoy
17
Index

Using HttpClient in Blazor WebAssembly

HTTP serves more than just web pages – it can also deliver data through HTTP methods. These are the HTTP methods that you will be using in this chapter:

  • GET: used to request one or more resources
  • POST: used to create a new resource
  • PUT: used to update the specified resource
  • DELETE: used to delete the specified resource

You'll use these four request patterns to complete the project in this chapter. The HttpClient service is a preconfigured service for making HTTP requests from a Blazor WebAssembly app to a server. It is configured in the Program.cs file of the Blazor WebAssembly app. The following code is used to configure it:

builder.Services.AddScoped(sp => new HttpClient {
    BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

The HttpClient service is injected into components using dependency injection (DI). To use the HttpClient service in a component, you must inject it by either using the @inject directive or the...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Blazor WebAssembly by Example
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon