Skip to content

Instantly share code, notes, and snippets.

@jesperbjensen
Created March 7, 2015 14:06
Show Gist options
  • Save jesperbjensen/556b4a46f7085a97f1a2 to your computer and use it in GitHub Desktop.
Save jesperbjensen/556b4a46f7085a97f1a2 to your computer and use it in GitHub Desktop.
A simple snippet for writing hello world using ASP.NET 5
// 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