-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kurt Monge
committed
Nov 29, 2024
1 parent
c409828
commit d56510b
Showing
30 changed files
with
5,538 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,47 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
VisualStudioVersion = 17.11.35327.3 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "oed-testdata.Api", "src\oed-testdata.Api\oed-testdata.Api.csproj", "{7DBED2C7-3D89-470A-A22A-CCAB536A6D56}" | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "oed-testdata.Server", "src\oed-testdata.Server\oed-testdata.Server.csproj", "{7E6A3415-9DFE-4899-9778-FDB7CF30BADE}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B889AC04-1D6D-4972-AA8D-0BFC61D3B1B3}" | ||
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "oed-testdata.client", "src\oed-testdata.client\oed-testdata.client.esproj", "{B33254FE-B8F8-4D07-AF7E-FA9CB232311F}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{69455680-9AC8-4D6B-AD31-A08D5FEB4BDC}" | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{71D9F4EC-FE79-49A9-A263-28A400FCEB8B}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "oed-testdata.UnitTest", "test\oed-testdata.UnitTest\oed-testdata.UnitTest.csproj", "{4C369A28-B4F8-4FAC-AC9F-7CE3CE3962E6}" | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "oed-testdata.Api", "src\oed-testdata.Api\oed-testdata.Api.csproj", "{7181DCF2-5C1A-4C49-AEC8-5598DB06985E}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "oed-testdata.UnitTest", "test\oed-testdata.UnitTest\oed-testdata.UnitTest.csproj", "{142693EE-4DBC-4E12-A85A-EDE32D8D32CA}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{7DBED2C7-3D89-470A-A22A-CCAB536A6D56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7DBED2C7-3D89-470A-A22A-CCAB536A6D56}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7DBED2C7-3D89-470A-A22A-CCAB536A6D56}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7DBED2C7-3D89-470A-A22A-CCAB536A6D56}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{4C369A28-B4F8-4FAC-AC9F-7CE3CE3962E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4C369A28-B4F8-4FAC-AC9F-7CE3CE3962E6}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4C369A28-B4F8-4FAC-AC9F-7CE3CE3962E6}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4C369A28-B4F8-4FAC-AC9F-7CE3CE3962E6}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{7E6A3415-9DFE-4899-9778-FDB7CF30BADE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7E6A3415-9DFE-4899-9778-FDB7CF30BADE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7E6A3415-9DFE-4899-9778-FDB7CF30BADE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7E6A3415-9DFE-4899-9778-FDB7CF30BADE}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{B33254FE-B8F8-4D07-AF7E-FA9CB232311F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B33254FE-B8F8-4D07-AF7E-FA9CB232311F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B33254FE-B8F8-4D07-AF7E-FA9CB232311F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{B33254FE-B8F8-4D07-AF7E-FA9CB232311F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B33254FE-B8F8-4D07-AF7E-FA9CB232311F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{B33254FE-B8F8-4D07-AF7E-FA9CB232311F}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
{7181DCF2-5C1A-4C49-AEC8-5598DB06985E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7181DCF2-5C1A-4C49-AEC8-5598DB06985E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7181DCF2-5C1A-4C49-AEC8-5598DB06985E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7181DCF2-5C1A-4C49-AEC8-5598DB06985E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{142693EE-4DBC-4E12-A85A-EDE32D8D32CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{142693EE-4DBC-4E12-A85A-EDE32D8D32CA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{142693EE-4DBC-4E12-A85A-EDE32D8D32CA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{142693EE-4DBC-4E12-A85A-EDE32D8D32CA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{7DBED2C7-3D89-470A-A22A-CCAB536A6D56} = {B889AC04-1D6D-4972-AA8D-0BFC61D3B1B3} | ||
{4C369A28-B4F8-4FAC-AC9F-7CE3CE3962E6} = {69455680-9AC8-4D6B-AD31-A08D5FEB4BDC} | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {9F0D1C12-BF80-4ACD-98E9-1FE4640C00CA} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This file explains how Visual Studio created the project. | ||
|
||
The following steps were used to generate this project: | ||
- Create new ASP\.NET Core Web API project. | ||
- Update `launchSettings.json` to register the SPA proxy as a startup assembly. | ||
- Update project file to add a reference to the frontend project and set SPA properties. | ||
- Add project to the startup projects list. | ||
- Write this file. |
33 changes: 33 additions & 0 deletions
33
src/oed-testdata.Server/Controllers/WeatherForecastController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace oed_testdata.Server.Controllers | ||
{ | ||
[ApiController] | ||
[Route("[controller]")] | ||
public class WeatherForecastController : ControllerBase | ||
{ | ||
private static readonly string[] Summaries = new[] | ||
{ | ||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||
}; | ||
|
||
private readonly ILogger<WeatherForecastController> _logger; | ||
|
||
public WeatherForecastController(ILogger<WeatherForecastController> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
[HttpGet(Name = "GetWeatherForecast")] | ||
public IEnumerable<WeatherForecast> Get() | ||
{ | ||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast | ||
{ | ||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), | ||
TemperatureC = Random.Shared.Next(-20, 55), | ||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] | ||
}) | ||
.ToArray(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Add services to the container. | ||
|
||
builder.Services.AddControllers(); | ||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | ||
builder.Services.AddEndpointsApiExplorer(); | ||
builder.Services.AddSwaggerGen(); | ||
|
||
var app = builder.Build(); | ||
|
||
app.UseDefaultFiles(); | ||
app.UseStaticFiles(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseSwagger(); | ||
app.UseSwaggerUI(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
|
||
app.UseAuthorization(); | ||
|
||
app.MapControllers(); | ||
|
||
app.MapFallbackToFile("/index.html"); | ||
|
||
app.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:64028", | ||
"sslPort": 44315 | ||
} | ||
}, | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "http://localhost:5149", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" | ||
} | ||
}, | ||
"https": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:7280;http://localhost:5149", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy" | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace oed_testdata.Server | ||
{ | ||
public class WeatherForecast | ||
{ | ||
public DateOnly Date { get; set; } | ||
|
||
public int TemperatureC { get; set; } | ||
|
||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | ||
|
||
public string? Summary { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<RootNamespace>oed_testdata.Server</RootNamespace> | ||
<SpaRoot>..\oed-testdata.client</SpaRoot> | ||
<SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand> | ||
<SpaProxyServerUrl>https://localhost:5173</SpaProxyServerUrl> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.SpaProxy"> | ||
<Version>8.*-*</Version> | ||
</PackageReference> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\oed-testdata.client\oed-testdata.client.esproj"> | ||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
</ProjectReference> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@oed_testdata.Server_HostAddress = http://localhost:5149 | ||
|
||
GET {{oed_testdata.Server_HostAddress}}/weatherforecast/ | ||
Accept: application/json | ||
|
||
### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This file explains how Visual Studio created the project. | ||
|
||
The following tools were used to generate this project: | ||
- create-vite | ||
|
||
The following steps were used to generate this project: | ||
- Create react project with create-vite: `npm init --yes vite@latest oed-testdata.client -- --template=react-ts`. | ||
- Update `vite.config.ts` to set up proxying and certs. | ||
- Add `@type/node` for `vite.config.js` typing. | ||
- Update `App` component to fetch and display weather information. | ||
- Create project file (`oed-testdata.client.esproj`). | ||
- Create `launch.json` to enable debugging. | ||
- Create `nuget.config` to specify location of the JavaScript Project System SDK (which is used in the first line in `oed-testdata.client.esproj`). | ||
- Add project to solution. | ||
- Update proxy endpoint to be the backend server endpoint. | ||
- Add project to the startup projects list. | ||
- Write this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# React + TypeScript + Vite | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
||
Currently, two official plugins are available: | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
|
||
## Expanding the ESLint configuration | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
|
||
- Configure the top-level `parserOptions` property like this: | ||
|
||
```js | ||
export default tseslint.config({ | ||
languageOptions: { | ||
// other options... | ||
parserOptions: { | ||
project: ['./tsconfig.node.json', './tsconfig.app.json'], | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}) | ||
``` | ||
|
||
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` | ||
- Optionally add `...tseslint.configs.stylisticTypeChecked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: | ||
|
||
```js | ||
// eslint.config.js | ||
import react from 'eslint-plugin-react' | ||
|
||
export default tseslint.config({ | ||
// Set the react version | ||
settings: { react: { version: '18.3' } }, | ||
plugins: { | ||
// Add the react plugin | ||
react, | ||
}, | ||
rules: { | ||
// other rules... | ||
// Enable its recommended rules | ||
...react.configs.recommended.rules, | ||
...react.configs['jsx-runtime'].rules, | ||
}, | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import js from '@eslint/js' | ||
import globals from 'globals' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
import reactRefresh from 'eslint-plugin-react-refresh' | ||
import tseslint from 'typescript-eslint' | ||
|
||
export default tseslint.config( | ||
{ ignores: ['dist'] }, | ||
{ | ||
extends: [js.configs.recommended, ...tseslint.configs.recommended], | ||
files: ['**/*.{ts,tsx}'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
globals: globals.browser, | ||
}, | ||
plugins: { | ||
'react-hooks': reactHooks, | ||
'react-refresh': reactRefresh, | ||
}, | ||
rules: { | ||
...reactHooks.configs.recommended.rules, | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React + TS</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<clear /> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | ||
</packageSources> | ||
<disabledPackageSources> | ||
<clear /> | ||
</disabledPackageSources> | ||
</configuration> |
Oops, something went wrong.