Skip to content

Instantly share code, notes, and snippets.

@leonmaia
Last active May 11, 2016 13:01
Show Gist options
  • Save leonmaia/1d5be26d0d62f68d2a8553ddf296d648 to your computer and use it in GitHub Desktop.
Save leonmaia/1d5be26d0d62f68d2a8553ddf296d648 to your computer and use it in GitHub Desktop.
public class HttpServer {
static InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 8888);
public static void main(String[] args) throws Exception {
Service<Request, Response> service = router();
ListeningServer server = Http.server().serve(addr, service);
Await.ready(server);
}
private static HttpMuxer router() {
return new HttpMuxer()
.withHandler("/cat", Handlers.echoHandler());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment