Created
July 7, 2010 04:15
-
-
Save skoon/466295 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class App | |
{ | |
private Context _context = null; | |
private List<IHandler> _getHandlers = null; | |
private List<IHandler> _postHandlers = null; | |
private List<IHandler> _putHandlers = null; | |
private List<IHandler> _deleteHandlers = null; | |
public App(Context context) | |
{ | |
_context = context; | |
} | |
public Context Context { get { return _context; } } | |
public void get(string route, Action<Context> handler) | |
{ | |
_getHandlers.Add(new GetHandler { Route=route, Handler = handler}); | |
} | |
public void get(Func<string> route, Action<Context> handler) | |
{ | |
get(route(), handler); | |
} | |
} | |
public static class AppExtensions | |
{ | |
public static void Write(this App app, string output) | |
{ | |
app.Context.Environment.Response.write(output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment