Skip to content

Instantly share code, notes, and snippets.

@aslakhellesoy
Created December 19, 2011 13:59
Show Gist options
  • Select an option

  • Save aslakhellesoy/1497355 to your computer and use it in GitHub Desktop.

Select an option

Save aslakhellesoy/1497355 to your computer and use it in GitHub Desktop.
Sinatra-Like DSL for Webbit
WebServer webServer = new NettyWebServer(9090);
Dsl dsl = new Dsl(webServer);
dsl.POST("/people", new HttpHandler(){
@Override
public void handleHttpRequest(HttpRequest req, HttpResponse res, HttpControl ctl) throws Exception {
int personId = 99;
res.redirect("/people/{personId}", personId);
}
});
dsl.GET("/people/{personId}", new HttpHandler(){
@Override
public void handleHttpRequest(HttpRequest req, HttpResponse res, HttpControl ctl) throws Exception {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment