Skip to content

Latest commit

 

History

History
58 lines (38 loc) · 1.08 KB

README.md

File metadata and controls

58 lines (38 loc) · 1.08 KB

lil-http-server4j

An experimental http server for utilising virtual thread features.

IMPORTANT!

Not for production uses!

Example Usage

class Main {
  
  public static void main(String[] args) throws IOException {
    try (var server = new HttpRequestHandler(20000)) {
      server.setHttpRequestListener((request) -> switch (request.path()) {
        case "/hello" -> new HttpResponses.Status200("text/plain-text", "hello");
        case "/bye" -> new HttpResponses.Status204();
        default -> new HttpResponses.Status404("text/plain-text", "404 error");
      });
      server.run();
    }
  }
}

Features

  • Uses Virtual Threads

Testing and Running Requirements

  • JDK version 20+

Importing Requirements

  • org.slf4j library
  • Testing and Running requirements

Development

Testing

./gradlew test

Building

./gradlew build

License

Licensed under MIT License