yegor256 / jpages

Experimental Java OOP Web Framework

Home Page:https://www.yegor256.com/2019/03/26/jpages.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo

EO principles respected here We recommend IntelliJ IDEA

mvn License Hits-of-Code

jPages is an experimental prototype of a web framework, which respects all possible principles of true object-oriented design. More about it in this blog post and in this webinar.

This is how you start a web app:

Thread thread = new Thread(
  () -> {
    App app = new App(
      new Page() {
        @Override
        public Page with(String name, String value) {
            if (value.equals("/")) {
              return new TextPage("Hello, world!");
            }
            return new TextPage("Not found!");
        }
        @Override
        public Output via(Output output) {
          return output.with("X-Body", "Not found");
        }
      }
    );
    try {
      app.start(8080);
    } catch (Exception ex) {
      System.out.println(ex.getMessage());
      throw new IllegalStateException(ex);
    }
  }
);
thread.setDaemon(true);
thread.start();

This repository is read-only now. Check yegor256/takes instead, it's in active development.

About

Experimental Java OOP Web Framework

https://www.yegor256.com/2019/03/26/jpages.html

License:MIT License


Languages

Language:Java 100.0%