You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this module, we will add a service named `ACA Web API – Frontend` as illustrated in the [architecture diagram](../../assets/images/00-workshop-intro/ACA-Architecture-workshop.jpg). This service will host a simple ASP.NET Razor pages web app which allows the end users to manage their tasks. After that we will provision Azure resources needed to deploy the service to ACA using Azure CLI.
10
10
### 1. Create the Frontend Web App project (Web APP)
11
11
12
-
- Open a command-line terminal and navigate to root folder of your project. Create a new folder as shown below:
12
+
- Open a command-line terminal and navigate to root folder of your project.
13
13
```shell
14
-
cd TasksTracker.ContainerApps
14
+
cd~\TasksTracker.ContainerApps
15
15
```
16
16
17
17
- From VS Code Terminal tab, open developer command prompt or PowerShell terminal in the project folder `TasksTracker.ContainerApps` and initialize the project. This will create and ASP.NET Razor Pages web app project.
@@ -21,6 +21,7 @@ In this module, we will add a service named `ACA Web API – Frontend` as illust
21
21
- We need to containerize this application, so we can push it to Azure Container Registry as a docker image then deploy it to ACA. Open the VS Code Command Palette (++ctrl+shift+p++) and select`Docker: Add Docker Files to Workspace...`
22
22
23
23
- Use `.NET: ASP.NET Core` when prompted for application platform.
24
+
- Choose `TasksTracker.WebPortal.Frontend.Ui\TasksTracker.WebPortal.Fortend.Ui.csproj` when prompted to choose a project file.
24
25
- Choose `Linux` when prompted to choose the operating system.
25
26
- You will be asked if you want to add Docker Compose files. Select `No`.
26
27
- Take a note of the provided **application port** as we will be using later on.
@@ -34,11 +35,11 @@ In this module, we will add a service named `ACA Web API – Frontend` as illust
34
35
--8<-- "docs/aca/02-aca-comm/TasksModel.cs"
35
36
```
36
37
37
-
- Now we will add 3 Razor pages for CRUD operations which will be responsible for listing all the tasks, creating a new task, and updating existing tasks.
38
+
- Now, in the **Tasks** folder, we will add 3 Razor pages for CRUD operations which will be responsible for listing all the tasks, creating a new task, and updating existing tasks.
38
39
By looking at the cshtml content notice that the page is expecting a query string named `createdBy` which will be used to group tasks for application users.
39
40
40
41
!!! note
41
-
We are following this approach here to keep the workshop simple, but for production applications authentication should be applied and the user email should be retrieved from the claims identity of the authenticated users.
42
+
We are following this approach here to keep the workshop simple, but for production applications, authentication should be applied and the user email should be retrieved from the claims identity of the authenticated users.
42
43
43
44
=== "Index.cshtml"
44
45
@@ -86,7 +87,7 @@ By looking at the cshtml content notice that the page is expecting a query strin
86
87
87
88
=== "Program.cs"
88
89
89
-
```csharp hl_lines="12 13 14 15 16"
90
+
```csharp hl_lines="12 13 14 15"
90
91
namespace TasksTracker.WebPortal.Frontend.Ui
91
92
{
92
93
public class Program
@@ -101,7 +102,6 @@ By looking at the cshtml content notice that the page is expecting a query strin
httpClient.BaseAddress = new Uri(builder.Configuration.GetValue<string>("BackendApiConfig:BaseUrlExternalHttp"));
104
-
105
105
});
106
106
107
107
var app = builder.Build();
@@ -136,7 +136,7 @@ This variable will contain the Base URL for the backend API deployed in the prev
136
136
- From VS Code Terminal tab, open developer command prompt or PowerShell terminal and navigate to the frontend directory which hosts the `.csproj` project folder and build the project.
137
137
138
138
```shell
139
-
cd {YourLocalPath}\TasksTracker.WebPortal.Frontend.Ui
139
+
cd ~\TasksTracker.ContainerApps\TasksTracker.WebPortal.Frontend.Ui
- Now we will build and push the Web App project docker image to ACR. Use the below command to initiate the image build and push process using ACR. The `.` at the end of the command represents the docker build context. In our case, we need to be on the parent directory which hosts the .csproject.
153
153
154
154
```powershell
155
-
cd {YourLocalPath}\TasksTracker.ContainerApps
155
+
cd ~\TasksTracker.ContainerApps
156
156
az acr build --registry $ACR_NAME --image "tasksmanager/$FRONTEND_WEBAPP_NAME" --file 'TasksTracker.WebPortal.Frontend.Ui/Dockerfile' .
157
157
```
158
158
Once this step is completed you can verify the results by going to the Azure portal and checking that a new repository named `tasksmanager/tasksmanager-frontend-webapp` has been created and there is a new docker image with a `latest` tag is created.
0 commit comments