Last active
December 16, 2015 13:19
-
-
Save loudej/5440695 to your computer and use it in GitHub Desktop.
OWIN Hello World
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
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