diff options
author | TrueDoctor <d-kobert@web.de> | 2018-09-27 19:42:06 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-09-27 19:42:06 +0200 |
commit | 09b0c5be9e23247411da850497b9cc6519d8f155 (patch) | |
tree | 771e022164ccde965f7d23fbbfc28587d5193987 /WebApplication1 | |
parent | e8dc39bf293aa0c6f2eb27104d5023c5a56e1ba4 (diff) |
testing
Diffstat (limited to 'WebApplication1')
-rw-r--r-- | WebApplication1/Controllers/ValuesController.cs | 45 | ||||
-rw-r--r-- | WebApplication1/Program.cs | 24 | ||||
-rw-r--r-- | WebApplication1/Properties/launchSettings.json | 30 | ||||
-rw-r--r-- | WebApplication1/Startup.cs | 47 | ||||
-rw-r--r-- | WebApplication1/WebApplication1.csproj | 15 | ||||
-rw-r--r-- | WebApplication1/appsettings.Development.json | 9 | ||||
-rw-r--r-- | WebApplication1/appsettings.json | 8 |
7 files changed, 178 insertions, 0 deletions
diff --git a/WebApplication1/Controllers/ValuesController.cs b/WebApplication1/Controllers/ValuesController.cs new file mode 100644 index 0000000..ac835f3 --- /dev/null +++ b/WebApplication1/Controllers/ValuesController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace WebApplication1.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class ValuesController : ControllerBase + { + // GET api/values + [HttpGet] + public ActionResult<IEnumerable<string>> Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/values/5 + [HttpGet("{id}")] + public ActionResult<string> Get(int id) + { + return "value"; + } + + // POST api/values + [HttpPost] + public void Post([FromBody] string value) + { + } + + // PUT api/values/5 + [HttpPut("{id}")] + public void Put(int id, [FromBody] string value) + { + } + + // DELETE api/values/5 + [HttpDelete("{id}")] + public void Delete(int id) + { + } + } +} diff --git a/WebApplication1/Program.cs b/WebApplication1/Program.cs new file mode 100644 index 0000000..8b7d1da --- /dev/null +++ b/WebApplication1/Program.cs @@ -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 WebApplication1 +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup<Startup>(); + } +} diff --git a/WebApplication1/Properties/launchSettings.json b/WebApplication1/Properties/launchSettings.json new file mode 100644 index 0000000..5d1f813 --- /dev/null +++ b/WebApplication1/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:1650", + "sslPort": 44303 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "WebApplication1": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/values", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +}
\ No newline at end of file diff --git a/WebApplication1/Startup.cs b/WebApplication1/Startup.cs new file mode 100644 index 0000000..9be97f9 --- /dev/null +++ b/WebApplication1/Startup.cs @@ -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 WebApplication1 +{ + 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(); + } + } +} diff --git a/WebApplication1/WebApplication1.csproj b/WebApplication1/WebApplication1.csproj new file mode 100644 index 0000000..710a1eb --- /dev/null +++ b/WebApplication1/WebApplication1.csproj @@ -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> diff --git a/WebApplication1/appsettings.Development.json b/WebApplication1/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/WebApplication1/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/WebApplication1/appsettings.json b/WebApplication1/appsettings.json new file mode 100644 index 0000000..def9159 --- /dev/null +++ b/WebApplication1/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} |