Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

yegor256/jpages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.