Skip to content

Test #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 94 commits into
base: main
Choose a base branch
from
Open

Test #55

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
20cca7b
ci: add Azure Static Web Apps workflow file
Chandradev819 Jul 5, 2025
e1d7c6d
PWA features Added.
Chandradev819 Jul 6, 2025
ac34c57
Merge pull request #1 from Chandradev819/CodeMigration
Chandradev819 Jul 6, 2025
eb0e2c4
Home Page.
Chandradev819 Jul 6, 2025
7b485e9
Update README.md
Chandradev819 Jul 6, 2025
a186739
Merge pull request #3 from Chandradev819/Chandradev819-patch-1
Chandradev819 Jul 6, 2025
c27d5bc
Pwa name updated
Chandradev819 Jul 6, 2025
5211d86
Merge pull request #2 from Chandradev819/CodeMigration
Chandradev819 Jul 6, 2025
86520da
Optimization Flags added
Chandradev819 Jul 7, 2025
5ac98f2
Merge pull request #4 from Chandradev819/CodeMigration
Chandradev819 Jul 7, 2025
25dd1b6
AOT removed.
Chandradev819 Jul 7, 2025
457bcb9
Code optimization
Chandradev819 Jul 7, 2025
39213ac
Merge pull request #5 from Chandradev819/CodeMigration
Chandradev819 Jul 7, 2025
3261b07
Code Optimization
Chandradev819 Jul 7, 2025
907a007
Merge pull request #6 from Chandradev819/CodeMigration
Chandradev819 Jul 7, 2025
c2e3677
Code reverted back
Chandradev819 Jul 7, 2025
ecb8a52
Merge pull request #7 from Chandradev819/CodeMigration
Chandradev819 Jul 7, 2025
480bccd
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 7, 2025
bb54370
Merge pull request #8 from Chandradev819/Chandradev819-patch-2
Chandradev819 Jul 7, 2025
d249c3b
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 7, 2025
c87d6c8
Merge pull request #10 from Chandradev819/Chandradev819-patch-4
Chandradev819 Jul 7, 2025
d9bd561
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 7, 2025
e7efefe
Merge pull request #11 from Chandradev819/Chandradev819-patch-5
Chandradev819 Jul 7, 2025
9c53034
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 7, 2025
a8cc1d7
Merge pull request #12 from Chandradev819/Chandradev819-patch-6
Chandradev819 Jul 7, 2025
b071222
CompressionEnabled done
Chandradev819 Jul 8, 2025
6fb0b46
Code Optimization
Chandradev819 Jul 8, 2025
a374114
Code Test
Chandradev819 Jul 8, 2025
9e17ae0
test
Chandradev819 Jul 8, 2025
3905444
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 8, 2025
c60a93a
Code updated.
Chandradev819 Jul 8, 2025
6fb182a
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 8, 2025
2f39fe5
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 8, 2025
54857ab
Code optimized.
Chandradev819 Jul 8, 2025
6e47118
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 8, 2025
89bff48
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 8, 2025
4ad5003
Code update
Chandradev819 Jul 8, 2025
1703914
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 8, 2025
46c122f
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 8, 2025
ec0d70d
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 8, 2025
943c16d
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 8, 2025
0e4efa1
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 8, 2025
af58ed3
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
38d2999
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
eba17a1
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
8283312
Code Cleanup done.
Chandradev819 Jul 9, 2025
5d1b0e6
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 9, 2025
245d8f4
Code optimize
Chandradev819 Jul 9, 2025
abf2c21
Code clean
Chandradev819 Jul 9, 2025
34099be
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
da7e874
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
9f9aedb
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
d8798cb
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
00247f5
code
Chandradev819 Jul 9, 2025
67877b4
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 9, 2025
fd695c8
Code.
Chandradev819 Jul 9, 2025
79127d9
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
6760b23
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
60f288e
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
b8b44ef
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
62af230
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
f3b9445
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
32a67ba
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
c325caf
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
9b1683f
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
4e61c89
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
4cb3e21
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
7e2f5e9
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
ed04cb0
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
13972b2
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
f31ea5f
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
9a8fe3e
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
45da432
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
4795773
Code updated.
Chandradev819 Jul 9, 2025
c09a818
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 9, 2025
5eea580
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
2a233d3
Code
Chandradev819 Jul 9, 2025
f8eb9c2
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 9, 2025
73dd4bc
Code.
Chandradev819 Jul 9, 2025
66cd722
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
5824265
Code pushed.
Chandradev819 Jul 9, 2025
53466fe
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 9, 2025
2039615
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
076ef1f
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
2b25ddf
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 9, 2025
ff805ff
code push
Chandradev819 Jul 9, 2025
8e9f11b
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 9, 2025
787bb21
code.
Chandradev819 Jul 9, 2025
ae623eb
Code updated.
Chandradev819 Jul 10, 2025
2db697e
Code updated.
Chandradev819 Jul 10, 2025
e6a524b
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 10, 2025
c7cf253
Update azure-static-web-apps-orange-water-0badfae10.yml
Chandradev819 Jul 10, 2025
d674f23
Code test
Chandradev819 Jul 10, 2025
ff276cc
Merge branch 'Test' of https://github.com/Chandradev819/BillMeApp int…
Chandradev819 Jul 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/azure-static-web-apps-orange-water-0badfae10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Azure Static Web Apps CI/CD

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

jobs:
build_and_deploy_job:
if: github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
lfs: false

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- name: Cache NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Cache .NET Workload Packs
uses: actions/cache@v3
with:
path: ~/.dotnet
key: ${{ runner.os }}-dotnet-workloads-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-dotnet-workloads-

- name: Install WASM Tools workload
run: dotnet workload install wasm-tools

- name: Publish Blazor WebAssembly (AOT + Brotli)
run: dotnet publish ./Client -c Release /p:BlazorWebAssemblyEnableAOT=true /p:CompressionEnabled=true

- name: Build and Deploy to Azure Static Web Apps
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_WATER_0BADFAE10 }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: upload
app_location: ./Client
api_location: Api
output_location: wwwroot

close_pull_request_job:
if: github.event_name == 'pull_request' &&
github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job

steps:
- name: Close Preview
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ORANGE_WATER_0BADFAE10 }}
action: close
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;

namespace Api
namespace Api.Functions
{
public class HttpTrigger
{
Expand Down
22 changes: 18 additions & 4 deletions Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,31 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>BlazorApp.Client</RootNamespace>
<RootNamespace>BlazorApp.Client</RootNamespace>
</PropertyGroup>

<!--<PropertyGroup Condition="'$(Configuration)'=='Release'">
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>link</TrimMode>
<EnableAnalyzer>true</EnableAnalyzer>
<BlazorEnableLinkerAnalyzer>true</BlazorEnableLinkerAnalyzer>
<InvariantGlobalization>true</InvariantGlobalization>
<BlazorWebAssemblyPreserveCollationData>false</BlazorWebAssemblyPreserveCollationData>
<BlazorWebAssemblyPreserveCultureData>false</BlazorWebAssemblyPreserveCultureData>
<StripDebugSymbols>true</StripDebugSymbols>
<DebugType>none</DebugType>
<CompressionEnabled>true</CompressionEnabled>
<BlazorWebAssemblyEnableAOT>true</BlazorWebAssemblyEnableAOT>
<BlazorWebAssemblyLazyLoadAssemblies>true</BlazorWebAssemblyLazyLoadAssemblies>
</PropertyGroup>-->


<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\Shared\Shared.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>

</Project>
4 changes: 1 addition & 3 deletions Client/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

<PageTitle>Home</PageTitle>

<h1>Hello, world!</h1>

Welcome to your new app.
<h1>Welcome to Bill Me App.</h1>
8 changes: 4 additions & 4 deletions Client/staticwebapp.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"navigationFallback": {
"rewrite": "/index.html"
}
}
"navigationFallback": {
"rewrite": "/index.html"
}
}
7 changes: 6 additions & 1 deletion Client/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<link rel="stylesheet" href="css/app.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<link href="Client.styles.css" rel="stylesheet" />
<link href="manifest.webmanifest" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
<link rel="apple-touch-icon" sizes="192x192" href="icon-192.png" />
<link rel="preload" href="_framework/blazor.webassembly.js" as="script">
</head>

<body>
Expand All @@ -26,7 +30,8 @@
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
<script>navigator.serviceWorker.register('service-worker.js');</script>
</body>

</html>
22 changes: 22 additions & 0 deletions Client/wwwroot/manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "BillMeApp",
"short_name": "BillMeApp",
"id": "./",
"start_url": "./",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#03173d",
"prefer_related_applications": false,
"icons": [
{
"src": "icon-512.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "icon-192.png",
"type": "image/png",
"sizes": "192x192"
}
]
}
4 changes: 4 additions & 0 deletions Client/wwwroot/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// In development, always fetch from the network and do not enable offline support.
// This is because caching would make development more difficult (changes would not
// be reflected on the first load after each change).
self.addEventListener('fetch', () => { });
55 changes: 55 additions & 0 deletions Client/wwwroot/service-worker.published.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Caution! Be sure you understand the caveats before publishing an application with
// offline support. See https://aka.ms/blazor-offline-considerations

self.importScripts('./service-worker-assets.js');
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
self.addEventListener('fetch', event => event.respondWith(onFetch(event)));

const cacheNamePrefix = 'offline-cache-';
const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`;
const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ];
const offlineAssetsExclude = [ /^service-worker\.js$/ ];

// Replace with your base path if you are hosting on a subfolder. Ensure there is a trailing '/'.
const base = "/";
const baseUrl = new URL(base, self.origin);
const manifestUrlList = self.assetsManifest.assets.map(asset => new URL(asset.url, baseUrl).href);

async function onInstall(event) {
console.info('Service worker: Install');

// Fetch and cache all matching items from the assets manifest
const assetsRequests = self.assetsManifest.assets
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
.map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' }));
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
}

async function onActivate(event) {
console.info('Service worker: Activate');

// Delete unused caches
const cacheKeys = await caches.keys();
await Promise.all(cacheKeys
.filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName)
.map(key => caches.delete(key)));
}

async function onFetch(event) {
let cachedResponse = null;
if (event.request.method === 'GET') {
// For all navigation requests, try to serve index.html from cache,
// unless that request is for an offline resource.
// If you need some URLs to be server-rendered, edit the following check to exclude those URLs
const shouldServeIndexHtml = event.request.mode === 'navigate'
&& !manifestUrlList.some(url => url === event.request.url);

const request = shouldServeIndexHtml ? 'index.html' : event.request;
const cache = await caches.open(cacheName);
cachedResponse = await cache.match(request);
}

return cachedResponse || fetch(event.request);
}
66 changes: 1 addition & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1 @@
# Blazor Starter Application

This template contains an example .NET 8 [Blazor WebAssembly](https://docs.microsoft.com/aspnet/core/blazor/?view=aspnetcore-6.0#blazor-webassembly) client application, a .NET 8 C# [Azure Functions](https://docs.microsoft.com/azure/azure-functions/functions-overview), and a C# class library with shared code.

## Getting Started

1. Create a repository from the [GitHub template](https://docs.github.com/en/enterprise/2.22/user/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) and then clone it locally to your machine.

1. In the **Api** folder, copy `local.settings.example.json` to `local.settings.json`

1. Continue using either Visual Studio or Visual Studio Code.

### Visual Studio 2022

Once you clone the project, open the solution in the latest release of [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) with the Azure workload installed, and follow these steps:

1. Right-click on the solution and select **Configure Startup Projects...**.

1. Select **Multiple startup projects** and set the following actions for each project:
- *Api* - **Start**
- *Client* - **Start**
- *Shared* - None

1. Press **F5** to launch both the client application and the Functions API app.

### Visual Studio Code with Azure Static Web Apps CLI for a better development experience (Optional)

1. Install (or update) the [Azure Static Web Apps CLI](https://www.npmjs.com/package/@azure/static-web-apps-cli) and [Azure Functions Core Tools CLI](https://www.npmjs.com/package/azure-functions-core-tools).

1. Open the folder in Visual Studio Code.

1. Delete file `Client/wwwroot/appsettings.Development.json`

1. In the VS Code terminal, run the following command to start the Static Web Apps CLI, along with the Blazor WebAssembly client application and the Functions API app:

In the Client folder, run:
```bash
dotnet run
```

In the API folder, run:
```bash
func start
```

In another terminal, run:
```bash
swa start http://localhost:5000 --api-location http://localhost:7071
```

The Static Web Apps CLI (`swa`) starts a proxy on port 4280 that will forward static site requests to the Blazor server on port 5000 and requests to the `/api` endpoint to the Functions server.

1. Open a browser and navigate to the Static Web Apps CLI's address at `http://localhost:4280`. You'll be able to access both the client application and the Functions API app in this single address. When you navigate to the "Fetch Data" page, you'll see the data returned by the Functions API app.
1. Enter Ctrl-C to stop the Static Web Apps CLI.
## Template Structure
- **Client**: The Blazor WebAssembly sample application
- **Api**: A C# Azure Functions API, which the Blazor application will call
- **Shared**: A C# class library with a shared data model between the Blazor and Functions application
## Deploy to Azure Static Web Apps
This application can be deployed to [Azure Static Web Apps](https://docs.microsoft.com/azure/static-web-apps), to learn how, check out [our quickstart guide](https://aka.ms/blazor-swa/quickstart).
This is Bill Me App.