Skip to content

Instantly share code, notes, and snippets.

@skoon
Created July 7, 2010 04:15
Show Gist options
  • Save skoon/466295 to your computer and use it in GitHub Desktop.
Save skoon/466295 to your computer and use it in GitHub Desktop.
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