mu-server 2.0.1 API

Mu-Server API Documentation

Mu-Server is a modern, lightweight web server library for Java.

An HTTP server is created by creating a server builder, such as MuServerBuilder.httpsServer() and then calling MuServerBuilder.start().

Handlers are added to the builder with the MuServerBuilder.addHandler(io.muserver.MuHandler) or MuServerBuilder.addHandler(io.muserver.Method, java.lang.String, io.muserver.RouteHandler) methods.

Rest resources can be created by using the RestHandlerBuilder.restHandler(java.lang.Object...) builder.

Hello, World

The following creates a server on HTTPS using a self-signed certificate, bound to a random port:

import io.muserver.MuServer;
import io.muserver.MuServerBuilder;

public class HelloServer {

    public static void main(String[] args) {
        MuServer server = MuServerBuilder.httpsServer()
            .addHandler((request, response) -> {
                response.write("Hello world");
                return true;
        System.out.println("Server started at " + server.uri());

More examples

For more documentation including the Maven artifact information, see

Package Description
This package contains the main API of mu-server, for example the server builders, request and response objects.
Some pre-built handlers for common tasks such as file handling.
A model of the Open API spec, which is used internally when creating documentation for JAX-RS services.
This package contains the JAX-RS implementation for mu-server.