diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c5a205c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,39 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md. + "name": ".NET Core Launch (web)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/Biblioteca/bin/Debug/net9.0/Biblioteca.dll", + "args": [], + "cwd": "${workspaceFolder}/Biblioteca", + "stopAtEntry": false, + // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" + } + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..060efb4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dotnet.defaultSolution": "Biblioteca.sln" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..7fa7e7f --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Biblioteca.sln", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/Biblioteca.sln", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/Biblioteca.sln" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Biblioteca.sln b/Biblioteca.sln new file mode 100644 index 0000000..882b875 --- /dev/null +++ b/Biblioteca.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Biblioteca", "Biblioteca\Biblioteca.csproj", "{5C038798-C6B7-4E20-8F97-2E2CCC721738}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Debug|x64.ActiveCfg = Debug|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Debug|x64.Build.0 = Debug|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Debug|x86.ActiveCfg = Debug|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Debug|x86.Build.0 = Debug|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Release|Any CPU.Build.0 = Release|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Release|x64.ActiveCfg = Release|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Release|x64.Build.0 = Release|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Release|x86.ActiveCfg = Release|Any CPU + {5C038798-C6B7-4E20-8F97-2E2CCC721738}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Biblioteca/Biblioteca.csproj b/Biblioteca/Biblioteca.csproj new file mode 100644 index 0000000..4bc7159 --- /dev/null +++ b/Biblioteca/Biblioteca.csproj @@ -0,0 +1,13 @@ + + + + net9.0 + enable + enable + + + + + + + diff --git a/Biblioteca/Biblioteca.http b/Biblioteca/Biblioteca.http new file mode 100644 index 0000000..1e14aae --- /dev/null +++ b/Biblioteca/Biblioteca.http @@ -0,0 +1,6 @@ +@Biblioteca_HostAddress = http://localhost:5000 + +GET {{Biblioteca_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/Biblioteca/Program.cs b/Biblioteca/Program.cs new file mode 100644 index 0000000..3917ef1 --- /dev/null +++ b/Biblioteca/Program.cs @@ -0,0 +1,41 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => +{ + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; +}) +.WithName("GetWeatherForecast"); + +app.Run(); + +record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} diff --git a/Biblioteca/Properties/launchSettings.json b/Biblioteca/Properties/launchSettings.json new file mode 100644 index 0000000..66bff66 --- /dev/null +++ b/Biblioteca/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7223;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Biblioteca/appsettings.Development.json b/Biblioteca/appsettings.Development.json new file mode 100644 index 0000000..ff66ba6 --- /dev/null +++ b/Biblioteca/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Biblioteca/appsettings.json b/Biblioteca/appsettings.json new file mode 100644 index 0000000..4d56694 --- /dev/null +++ b/Biblioteca/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}