# CiWeb **Repository Path**: helloman/CiWeb ## Basic Information - **Project Name**: CiWeb - **Description**: 基于netty封装的简易web服务,适合java-web-api接口开发。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 45 - **Created**: 2015-10-20 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #CiWeb 基于netty做了简单封装,方便快捷web接口开发。 支持开发时热更新 支持静态文件 #example#
public class Demo {
public static void main(String[] args) {
CiConfig config = new CiConfig();
config.port(8080).fileDir("www").filePath("/img/;/js/;/css/")
.handlerPackage("ci.demo")
.handlerDir("bin/");
CiService service = new CiService(config);
service.start();
service.dev();
}
}
# 编写接口 #
http://domain/ClassName/MethodName?web参数
package ci.demo;
import ci.web.annotaction.Param;
import ci.web.core.CiContext;
public class User {
//http://127.0.0.1/user/hello
public void hello(CiContext ctx){
System.out.println("User.hello#"+ctx.params().toJSONString());
ctx.send("User.hello");
}
//http://127.0.0.1/user/login?email=test@xx.com&pwd=xxx
public void login(CiContext ctx, @Param("email") String email, @Param("pwd") String passWord){
System.out.println("User.login#"+email+" : "+passWord);
ctx.send("User.login");
}
}