unpbun / http

Lightweight Java http server and web application framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

http Build Status

Lightweight Java http server and web application framework.

Example

Basic route

    HttpServer server = HttpServer.bind(8080);
    server.accept(new Controller() {
        @Get("/")
        public HttpHandler index() {
            return ok();
        }
    });
    server.listen();

Parameterized route

    HttpServer server = HttpServer.bind(8080);
    server.accept(new Controller() {
        @Get("/user/{username}")
        public HttpHandler index(String username) {
            return ok();
        }
    });
    server.listen();

Keep in mind, annotation-based routes can be limiting, as the only supported pattern for parameters is .+. Using the Router directly provides full support for custom regex, parameter ordering, and delegation to any instantiated class and its methods.

About

Lightweight Java http server and web application framework.

License:MIT License


Languages

Language:Java 100.0%