# easyweb **Repository Path**: oneslideicywater/easyweb ## Basic Information - **Project Name**: easyweb - **Description**: 极简web框架 - **Primary Language**: Java - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2020-09-19 - **Last Updated**: 2022-09-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README == Get Started === Maven 将代码片段放入maven pom文件 [source,xml] ---- com.oneslide easyweb 1.0 UTF-8 ---- === Controller [source,java] ---- @Controller("/rest") public class SampleController { // main public static void main(String[] args) throws Exception { WebEntry.run(".*"); Logger.info(Router.ROUTER_GRAPH); } /** simple GET **/ @EndPoint(value = "/hello") public String helloWorld(){ return "hello world"; } /** * GET with url param * **/ @EndPoint(value = "/helloback") public String hello2(@Param(value = "projectId",required = true) String projectId){ return projectId; } /** * GET with multiple params * **/ @EndPoint(value = "/multihello") public Map hello(@Param(value = "projectId",required = true) String projectId, @Param(value = "test",required = true)String test){ HashMap hello=new HashMap<>(); hello.put("projectId",projectId); hello.put("test",test); return hello; } /** * GET with request body * **/ @EndPoint(value = "/postPersonParam",method = HTTPMethod.POST) public Map getWithRequestBody(@RequestBody("person") Person person, @Param(value = "test",required = true)String test){ HashMap hello=new HashMap<>(); hello.put(test,person); return hello; } /** * POST with request body * **/ @EndPoint(value = "/postPerson",method = HTTPMethod.POST) public Person postWithRequestBody(@RequestBody("person") Person person) { return person; } /** * pass a list * **/ @EndPoint(value = "/postList",method = HTTPMethod.POST) public List postWithRequestBody(@RequestBody("list") List persons) { return persons; } } ---- ==== 测试 [source,bash] ---- curl localhost:8089/rest/hello ---- === Architecture image::doc/img/arch.png[]