use of com.example.akka.routes.Routes in project swagger-akka-http-sample-java by pjfanning.
the class Main method main.
public static void main(String[] args) throws Exception {
// boot up server using the route as defined below
ActorSystem system = ActorSystem.create("routes");
final Http http = Http.get(system);
// In order to access all directives we need an instance where the routes
// are defined.
Main app = new Main();
final Route routes = app.concat(new Routes().createRoute(), new SwaggerDocService().createRoute());
final CompletionStage<ServerBinding> binding = http.newServerAt("localhost", 12345).bind(routes);
System.out.println("Server online at http://localhost:12345/\nPress RETURN to stop...");
// let it run until user presses return
System.in.read();
// trigger unbinding from the port
binding.thenCompose(ServerBinding::unbind).thenAccept(// and shutdown when done
unbound -> system.terminate());
}
Aggregations