# http-server **Repository Path**: chiang-hao/http-server ## Basic Information - **Project Name**: http-server - **Description**: Java nio 实现 http协议服务器 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-10-06 - **Last Updated**: 2023-03-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # http-server ## 介绍 使用Java nio实现的一个简单http协议 #### 参与贡献 参考java nio 的相关知识 ## 使用说明 程序从NioService开始运行如下所示 ``` public static void main(String[] args) throws IOException { new NioService(8090).addRoute(new HttpRoute(HttpMethod.GET,"/asdfad",(req,resp)->{ try { resp.getOutput().write("{\"code\":1}".getBytes(Charset.forName("UTF-8"))); } catch (IOException e) { throw new RuntimeException(e); } })).start(); } ```