Skip to content

Functional Owin Middleware with an honest function signature. this extension library lets you inject dependencies directly at the USE call and will close over the dependencies before the delegate is passed to the Owin framework.

Notifications You must be signed in to change notification settings

sdedalus/HonestMiddleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HonestMiddleware

Functional Owin Middleware with an honest function signature. This extension library lets you inject dependencies directly at the USE call and will close over the dependencies before the delegate is passed to the Owin framework. you can define your middleware like this:

public Task WriteAsync(string what, PathString path, IOwinContext context, Func<Task> next)
{
	if (context.Request.Path == path)
		using (var writer = new StreamWriter(context.Response.Body))
		{
			return writer.WriteAsync(what);
		}
	else
	{
		return next();
	}
}

and register it like this:

app.Use("{'greeting':'Hello!'}", new PathString("/hello"), WriteAsync);

About

Functional Owin Middleware with an honest function signature. this extension library lets you inject dependencies directly at the USE call and will close over the dependencies before the delegate is passed to the Owin framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages