From 44cb5f11bdffb300292fd67f03948ae0dadabe94 Mon Sep 17 00:00:00 2001 From: "jaloliddin.mahkamov@mail.ru" Date: Fri, 24 May 2024 18:54:45 +0500 Subject: [PATCH] INFRA: UsefulTime Api Project Initialize --- UsefulTime.Api/Controllers/HomeController.cs | 18 ++++++++ UsefulTime.Api/Program.cs | 25 +++++++++++ UsefulTime.Api/Properties/launchSettings.json | 41 +++++++++++++++++++ UsefulTime.Api/UsefulTime.Api.csproj | 14 +++++++ UsefulTime.Api/UsefulTime.Api.http | 6 +++ UsefulTime.Api/appsettings.Development.json | 8 ++++ UsefulTime.Api/appsettings.json | 9 ++++ UsefulTime.sln | 6 +++ 8 files changed, 127 insertions(+) create mode 100644 UsefulTime.Api/Controllers/HomeController.cs create mode 100644 UsefulTime.Api/Program.cs create mode 100644 UsefulTime.Api/Properties/launchSettings.json create mode 100644 UsefulTime.Api/UsefulTime.Api.csproj create mode 100644 UsefulTime.Api/UsefulTime.Api.http create mode 100644 UsefulTime.Api/appsettings.Development.json create mode 100644 UsefulTime.Api/appsettings.json diff --git a/UsefulTime.Api/Controllers/HomeController.cs b/UsefulTime.Api/Controllers/HomeController.cs new file mode 100644 index 0000000..609f29f --- /dev/null +++ b/UsefulTime.Api/Controllers/HomeController.cs @@ -0,0 +1,18 @@ +//================================================= +//Copyright (c) Coalition of Good-Hearted Engineers +//Free To Use To Find Comfort and Pease +//================================================= +using Microsoft.AspNetCore.Mvc; +using RESTFulSense.Controllers; + +namespace UsefulTime.Api.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class HomeController : RESTFulController + { + [HttpGet] + public ActionResult Get() => + Ok("Hello Mario, the princess is in another castle."); + } +} diff --git a/UsefulTime.Api/Program.cs b/UsefulTime.Api/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/UsefulTime.Api/Program.cs @@ -0,0 +1,25 @@ +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(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/UsefulTime.Api/Properties/launchSettings.json b/UsefulTime.Api/Properties/launchSettings.json new file mode 100644 index 0000000..f8d3e91 --- /dev/null +++ b/UsefulTime.Api/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:8937", + "sslPort": 44321 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5156", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7257;http://localhost:5156", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/UsefulTime.Api/UsefulTime.Api.csproj b/UsefulTime.Api/UsefulTime.Api.csproj new file mode 100644 index 0000000..39dc33b --- /dev/null +++ b/UsefulTime.Api/UsefulTime.Api.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/UsefulTime.Api/UsefulTime.Api.http b/UsefulTime.Api/UsefulTime.Api.http new file mode 100644 index 0000000..ff98666 --- /dev/null +++ b/UsefulTime.Api/UsefulTime.Api.http @@ -0,0 +1,6 @@ +@UsefulTime.Api_HostAddress = http://localhost:5156 + +GET {{UsefulTime.Api_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/UsefulTime.Api/appsettings.Development.json b/UsefulTime.Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/UsefulTime.Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/UsefulTime.Api/appsettings.json b/UsefulTime.Api/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/UsefulTime.Api/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/UsefulTime.sln b/UsefulTime.sln index 4bf6850..ef94872 100644 --- a/UsefulTime.sln +++ b/UsefulTime.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.10.34902.84 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsefulTime.Build.Project", "UsefulTime.Build.Project\UsefulTime.Build.Project.csproj", "{8AEE94B6-7922-441A-BA9E-B7F84FB0D235}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsefulTime.Api", "UsefulTime.Api\UsefulTime.Api.csproj", "{D7F4508D-85FA-4537-ACA3-170FAEDC9C3F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {8AEE94B6-7922-441A-BA9E-B7F84FB0D235}.Debug|Any CPU.Build.0 = Debug|Any CPU {8AEE94B6-7922-441A-BA9E-B7F84FB0D235}.Release|Any CPU.ActiveCfg = Release|Any CPU {8AEE94B6-7922-441A-BA9E-B7F84FB0D235}.Release|Any CPU.Build.0 = Release|Any CPU + {D7F4508D-85FA-4537-ACA3-170FAEDC9C3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7F4508D-85FA-4537-ACA3-170FAEDC9C3F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7F4508D-85FA-4537-ACA3-170FAEDC9C3F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7F4508D-85FA-4537-ACA3-170FAEDC9C3F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE