Last active
July 14, 2020 11:08
-
-
Save stevejgordon/ee243d05c749362839b5223bcaa6e7a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.Hosting; | |
namespace BasicWebSite | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) => CreateHostBuilder(args).Build().Run(); | |
public static IHostBuilder CreateHostBuilder(string[] args) => | |
Host.CreateDefaultBuilder(args) | |
.ConfigureWebHostDefaults(webBuilder => | |
webBuilder.UseStartup<Startup>()); | |
} | |
public class Startup | |
{ | |
public void Configure(IApplicationBuilder app) | |
{ | |
app.Use(async (context, next) => | |
{ | |
if (context.Request.Path == "/") | |
{ | |
await context.Response.WriteAsync("Hello World!"); | |
return; | |
} | |
await next(); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment