import io.activej.http.*;
import io.activej.inject.annotation.*;
import io.activej.launcher.*;
@Inject
HttpServer server;
@Override
protected void run() throws Exception {
server.setServlet(HttpServlet.create()
.withPath("/")
.withMethod(HttpMethod.GET)
.withHandler((request, response) -> response.write("Hello, World!")));
return Promise.complete();
}
public static void main(String[] args) throws Exception {
Launcher launcher = new Launcher() {
@Provides
HttpServer httpServer() {
return HttpServer.create();
}
};
launcher.launch(args);
}