Api application skeleton added.

This commit is contained in:
Andrey Shabarshov 2021-12-07 15:29:55 +00:00
parent 7f4191bcc2
commit 9c5ed39950
8 changed files with 147 additions and 1 deletions

View File

@ -7,7 +7,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRBee.Android", "QRBee\QRBe
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRBee.iOS", "QRBee\QRBee.iOS\QRBee.iOS.csproj", "{D46DBAB1-19E0-441C-B2DB-38F1620C160E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRBee.iOS", "QRBee\QRBee.iOS\QRBee.iOS.csproj", "{D46DBAB1-19E0-441C-B2DB-38F1620C160E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRBee", "QRBee\QRBee\QRBee.csproj", "{9C717836-BE20-4721-877B-8B6250245FF9}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRBee", "QRBee\QRBee\QRBee.csproj", "{9C717836-BE20-4721-877B-8B6250245FF9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRBeeApi", "QRBeeApi\QRBeeApi.csproj", "{D985A736-12A3-4A7A-B1A7-502321BD460A}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -73,6 +75,18 @@ Global
{9C717836-BE20-4721-877B-8B6250245FF9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {9C717836-BE20-4721-877B-8B6250245FF9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{9C717836-BE20-4721-877B-8B6250245FF9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {9C717836-BE20-4721-877B-8B6250245FF9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{9C717836-BE20-4721-877B-8B6250245FF9}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU {9C717836-BE20-4721-877B-8B6250245FF9}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Debug|iPhone.Build.0 = Debug|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Release|Any CPU.Build.0 = Release|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Release|iPhone.ActiveCfg = Release|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Release|iPhone.Build.0 = Release|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D985A736-12A3-4A7A-B1A7-502321BD460A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;
namespace QRBeeApi.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 = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}

25
QRBeeApi/Program.cs Normal file
View File

@ -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();

View File

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:1103",
"sslPort": 44300
}
},
"profiles": {
"QRBeeApi": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7000;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

13
QRBeeApi/QRBeeApi.csproj Normal file
View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
namespace QRBeeApi
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}