Created
March 7, 2015 14:06
-
-
Save jesperbjensen/556b4a46f7085a97f1a2 to your computer and use it in GitHub Desktop.
A simple snippet for writing hello world using ASP.NET 5
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
// Inline lampda: | |
public void Configure(IApplicationBuilder app) | |
{ | |
// "" is the route - so this is just the root path | |
app.Map("", x => | |
{ | |
x.Run(m => m.Response.WriteAsync("Hello, World!")); | |
}); | |
} | |
// Other function | |
public void Configure(IApplicationBuilder app) | |
{ | |
app.Map("", x => | |
{ | |
x.Run(FrontPage); | |
}); | |
} | |
public async Task FrontPage(HttpContext context) | |
{ | |
await context.Response.WriteAsync("Hello, World!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment