# CiWeb **Repository Path**: 5095zhangwei/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**: 46 - **Created**: 2015-11-07 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #CiWeb# 基于netty做了简单封装,方便快捷web接口开发。 支持开发时热更新 支持静态文件 和 websocket #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/"); //设置脚本搜索目录 或者 jar文件,具体看自己运行环境设置

        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");
    }
}
**包路径说明** ci.web.core : http请求/http响应 ci.web.router : 路由处理,将请求解析到对应接口处理 ci.web.codec : http/websocket解码