Skip to content

Instantly share code, notes, and snippets.

@xhanin
Created August 14, 2012 09:50
Show Gist options
  • Save xhanin/3347906 to your computer and use it in GitHub Desktop.
Save xhanin/3347906 to your computer and use it in GitHub Desktop.
Vert.x with Java 8 Lambda
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.deploy.Verticle;
public class Server extends Verticle {
@Override
public void start() throws Exception {
vertx.createHttpServer().requestHandler((HttpServerRequest req) -> {
String file = req.path.equals("/") ? "index.html" : req.path;
req.response.sendFile(file);
}).listen(8086);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment