From de09b251ceb8f6bf958119b0b2b6916fc0693172 Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Sat, 7 Sep 2024 11:06:51 +0300 Subject: [PATCH] Initialized webapi --- Program.cs | 20 +++++++++++++++++ Properties/launchSettings.json | 41 ++++++++++++++++++++++++++++++++++ appsettings.Development.json | 8 +++++++ appsettings.json | 9 ++++++++ renis-backend.csproj | 15 +++++++++++++ renis-backend.http | 6 +++++ 6 files changed, 99 insertions(+) create mode 100644 Program.cs create mode 100644 Properties/launchSettings.json create mode 100644 appsettings.Development.json create mode 100644 appsettings.json create mode 100644 renis-backend.csproj create mode 100644 renis-backend.http diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..19f4057 --- /dev/null +++ b/Program.cs @@ -0,0 +1,20 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.Run(); + diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..d9ffe44 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:20930", + "sslPort": 44313 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5130", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7278;http://localhost:5130", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/appsettings.Development.json b/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/renis-backend.csproj b/renis-backend.csproj new file mode 100644 index 0000000..6c10cee --- /dev/null +++ b/renis-backend.csproj @@ -0,0 +1,15 @@ + + + + net8.0 + enable + enable + renis_backend + + + + + + + + diff --git a/renis-backend.http b/renis-backend.http new file mode 100644 index 0000000..e0435d7 --- /dev/null +++ b/renis-backend.http @@ -0,0 +1,6 @@ +@renis_backend_HostAddress = http://localhost:5130 + +GET {{renis_backend_HostAddress}}/weatherforecast/ +Accept: application/json + +###