Skip to content

Instantly share code, notes, and snippets.

@loudej
Last active December 16, 2015 13:19
Show Gist options
  • Save loudej/5440695 to your computer and use it in GitHub Desktop.
Save loudej/5440695 to your computer and use it in GitHub Desktop.
OWIN Hello World
using Owin;
namespace HelloOwin
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
// example of a filter - writeline each request
app.UseFilter(req => req.TraceOutput.WriteLine(
"{0} {1}{2} {3}",
req.Method,
req.PathBase,
req.Path,
req.QueryString));
// example of a handler - all paths reply Hello, Owin!
app.UseHandler(async (req, res) =>
{
res.ContentType = "text/plain";
await res.WriteAsync("Hello, OWIN!");
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment