# light **Repository Path**: liyongyao/light ## Basic Information - **Project Name**: light - **Description**: 利用Netty构建Http服务,供其他服务调用,搭建轻分布式服务的小工具 - **Primary Language**: Java - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 39 - **Forks**: 14 - **Created**: 2016-03-21 - **Last Updated**: 2023-07-25 ## Categories & Tags **Categories**: web-service **Tags**: None ## README 一、快速入门 1.简单配置 resources下server-config.xml ``` ``` 2.查看test包下示例: @HttpInterface 注解表示公开该类的方法 @HttpPath 注解表示路径,例如: ``` @HttpInterface @HttpPath("/demo") public class DemoAPI { @HttpPath("/helloString") public void helloString(ApiRequest request, ApiResponse response) { DemoModel data = request.getData(DemoModel.class); response.setData("hello "+data.getName()); } …… } ``` void helloString(ApiRequest request, ApiResponse response) 方法的请求路径为/demo/helloString 二、约定 api方法的写法是固定的 public void methodName(ApiRequest request, ApiResponse response) 三、启动服务 new HttpServer().start();