public class HelloWorld { public static void main(String[] args) { new RvcServer() .before(() -> { Response.get().gzip(); }) .get("/hello", () -> "Hello world!") .start(); } }
Or you can use
Main.java
public class Main { public static void main(String[] args) throws Exception { RvcServer rvcServer = new RvcServer().port(4567); rvcServer.init(); rvcServer.classes( WelcomeController.class /* add more classes here */ ) .start(); } }
WelcomeController.java
import rvc.ann.*; @Controller public class WelcomeController { @GET Object index(){ return "hello world"; } @GET @Json Object toJson(){ return "hello, world".split(","); } }
Start you code and enter to these urls
Here my real project using this "framework".