Api Project

This commit is contained in:
2018-10-04 21:13:32 +02:00
parent f303541a01
commit 3b88ea1d48
7 changed files with 137 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ConfigController : ControllerBase
{
// GET api/Config
[HttpGet]
public ActionResult<IEnumerable<string>> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/Config/5
[HttpGet("{id}")]
public ActionResult<string> Get(int id)
{
return "value";
}
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace LaDOSE.Api
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace LaDOSE.Api
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseMvc();
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2041
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaDOSE.DiscordBot", "LaDOSE.DiscordBot\LaDOSE.DiscordBot.csproj", "{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaDOSE.DiscordBot", "LaDOSE.DiscordBot\LaDOSE.DiscordBot.csproj", "{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaDOSE.Api", "LaDOSE.Api\LaDOSE.Api.csproj", "{4D7ED4CC-F78F-4860-B8CE-DA01DCACCBB9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}.Release|Any CPU.Build.0 = Release|Any CPU
{4D7ED4CC-F78F-4860-B8CE-DA01DCACCBB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D7ED4CC-F78F-4860-B8CE-DA01DCACCBB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D7ED4CC-F78F-4860-B8CE-DA01DCACCBB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D7ED4CC-F78F-4860-B8CE-DA01DCACCBB9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE