src/main/java/jp/gr/java_conf/hhiroshell/cowweb/Main.java
static WebServer startServer() throws IOException {

        // load logging configuration
        LogManager.getLogManager().readConfiguration(
                Main.class.getResourceAsStream("/logging.properties"));

        // By default this will pick up application.yaml from the classpath
        Config config = Config.create();

        // Get webserver config from the "server" section of application.yaml
        ServerConfiguration serverConfig =
                ServerConfiguration.create(config.get("server"));

        WebServer server = WebServer.create(serverConfig, createRouting(config));

        // Start the server and print some info.
        server.start().thenAccept(ws -> {
            System.out.println(
                    "WEB server is up! http://localhost:" + ws.port() + "/cowsay");
        });

        // Server threads are not daemon. NO need to block. Just react.
        server.whenShutdown().thenRun(()
                -> System.out.println("WEB server is DOWN. Good bye!"));

        return server;
    }
/**
     * Start the server.
     * @return the created {@link WebServer} instance
     * @throws IOException if there are problems reading logging properties
     */
Start the server.
@return the created  WebServer instance
@throws IOException if there are problems reading logging properties
Start the server . @return the created WebServer instance @throws IOException if there are problems reading logging properties
static WebServer startServer() throws IOException {
        LogManager.getLogManager().readConfiguration(
                Main.class.getResourceAsStream("/logging.properties"));
        Config config = Config.create();
        ServerConfiguration serverConfig =
                ServerConfiguration.create(config.get("server"));
        WebServer server = WebServer.create(serverConfig, createRouting(config));
        server.start().thenAccept(ws -> {
            System.out.println(
                    "WEB server is up! http://localhost:" + ws.port() + "/cowsay");
        });
        server.whenShutdown().thenRun(()
                -> System.out.println("WEB server is DOWN. Good bye!"));
        return server;
    }
static WebServer startServer ( ) throws IOException { LogManager . getLogManager ( ) . readConfiguration ( Main . class . getResourceAsStream ( "/logging.properties" ) ) ; Config config = Config . create ( ) ; ServerConfiguration serverConfig = ServerConfiguration . create ( config . get ( "server" ) ) ; WebServer server = WebServer . create ( serverConfig , createRouting ( config ) ) ; server . start ( ) . thenAccept ( ws -> { System . out . println ( "WEB server is up! http://localhost:" + ws . port ( ) + "/cowsay" ) ; } ) ; server . whenShutdown ( ) . thenRun ( ( ) -> System . out . println ( "WEB server is DOWN. Good bye!" ) ) ; return server ; }
Start the server.
Start the server .
// load logging configuration // By default this will pick up application.yaml from the classpath // Get webserver config from the "server" section of application.yaml // Start the server and print some info. // Server threads are not daemon. NO need to block. Just react.