-
-
Save aensidhe/1852bac59db379d3af250e1ea44a7eb1 to your computer and use it in GitHub Desktop.
Almost minimal asp.net core sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using Microsoft.AspNetCore; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
namespace MinimalAspNetCore | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) => WebHost.CreateDefaultBuilder(args).UseStartup<Program>().Build().Run(); | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
app.Map(new PathString("/ping"), x => x.Run(Ping)); | |
app.Map(new PathString("/pong"), x => x.Run(Pong)); | |
} | |
private static async Task Ping(HttpContext context) => await context.Response.WriteAsync("PING RESPONSE"); | |
private static async Task Pong(HttpContext context) => await context.Response.WriteAsync("PONG RESPONSE"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.AspNetCore.All" /> | |
</ItemGroup> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment