Skip to content

Latest commit

 

History

History

c4-WebApiComplete

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Connecting to a remote web API service

This example is part of a recipe from the book published by Packt:

.NET MAUI Cookbook: Build a full-featured app swiftly with MVVM, CRUD, AI, authentication, real-time updates, and more

In the book, this recipe covers:

  • The basics of connecting to a Web API service from a .NET MAUI app.
  • Modifying the existing repository to interact with a Web API service.

Note: This example may not include all the points mentioned above. For complete details, please refer to the corresponding recipe in the book.

Running the Example

Visual Studio

  1. Run the c4-WebApiServer project without debugging.

Starting a WebAPI service without debugging

  1. Select c4-WebApiMauiClient as startup project.

Selecting the startup project

  1. Select the debugging device.

Selecting the device

  1. Start debugging the c4-WebApiMauiClient project.

VS Code

  1. Open the folder with the solution (File | Open Folder) and in in the Terminal window, run the following command to navigate to the server folder:
    cd c4-WebApiServer
    
  2. Start the server using the https profile defined in Properties | launchSettings.json by running:
    dotnet run --launch-profile https
    
    The server should start on port 7197, as specified in the launchSettings.json file.
  3. Open this URL in your browser to view Swagger: https://localhost:7197/swagger
  4. To run the client .NET MAUI project, use either the .NET Meteor or .NET MAUI VS Code extensions. Follow the setup steps in each extension's documentation to get started.

Output

MAUI Web API