Skip to content

green4j/newa

Repository files navigation

Netty-based Web API (NeWA)

Netty-based minimalistic REST and Websocket server framework.

REST Server

public class HelloRestServer extends DefaultRestServerStarter {

    public HelloRestServer() {
        super("HelloAPI",
                1,
                "My HelloAPI Server",
                "0.0.1",
                "127.0.0.1",
                9009);
    }

    @Override
    protected RestApi buildRestApi(final RestApi.Builder builder) {
        builder.getJson("/hello/{name}", (request, pathParameters, output) -> {
            output.stringValue(String.format("Hello %s!", pathParameters.parameterValue("name")));
        });
        builder.getJson("/jvm/info", new Json_JvmInfo());
        builder.getJson("/jvm/threads", new Json_JvmThreadDump());
        builder.getJson("/shutdown", new Json_Shutdown(aSwitch()));
        return builder.buildWithHelp(Json_Help.factory());
    }

    public static void main(String[] args) {
        new HelloRestServer().start();
    }
}

Websocket Server

TBD

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages