package lc.esp.viewpoint.service;

import lc.esp.engine.ESPEngine;
import lc.mecha.fabric.HandlerStatus;
import lc.mecha.http.server.HttpTransaction;
import lc.mecha.http.server.PrefixedHandler;

import java.util.Set;

public class ViewpointService {
    public static void main(String[] args) throws Exception {
        ESPEngine esp = new ESPEngine();
        esp.register(new PrefixedHandler(Set.of("/api/example")) {
            @Override
            public HandlerStatus handlePrefixedWebRequest(HttpTransaction request) throws Throwable {
                request.httpServletResponse.getOutputStream().write("Hello World\n".getBytes());
                return HandlerStatus.BREAK;
            }
        });
        esp.runDangerously();
    }
}
