Skip to content

Instantly share code, notes, and snippets.

@p-
Created September 4, 2018 13:15
Show Gist options
  • Save p-/c9e98b83e9fbd6394a3e4e5ce106d12a to your computer and use it in GitHub Desktop.
Save p-/c9e98b83e9fbd6394a3e4e5ce106d12a to your computer and use it in GitHub Desktop.
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
namespace SimpleTestServer_DotNet
{
public static class SimpleTestServer
{
public static void Main(string[] args) =>
WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build().Run();
}
public class Startup
{
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Run(async context =>
{
context.Response.Headers.Add("Content-Type", "application/json");
await context.Response.WriteAsync("{ \"path\":\"" + context.Request.Path + "\" }");
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment