Servest 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
Servest 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
Servest 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 MIT
操作系统 跨平台
软件类型 开源软件
所属分类 服务器软件HTTP服务器
开源组织
地区 不详
投 递 者 h4cd
适用人群 未知
收录时间 2020-05-13

软件简介

Servest 是 Deno 的 HTTP 模块套件,它由 HTTP 协议相关的三个主要 API 组成:

  • Router API:通用 HTTP 路由服务器。
  • Server API:用于处理 HTTP/1.1 请求的低级 HTTP API。
  • Agent API:用于管理与主机的 HTTP/1.1 Keep-Alive 连接的低级 API。
// @deno-types="https://servestjs.org/@v1.0.0-rc2/types/react/index.d.ts"
import React from "https://dev.jspm.io/react/index.js";
// @deno-types="https://servestjs.org/@v1.0.0-rc2/types/react-dom/server/index.d.ts"
import ReactDOMServer from "https://dev.jspm.io/react-dom/server.js";
import { createApp } from "https://servestjs.org/@v1.0.0-rc2/mod.ts";

const app = createApp();
app.handle("/", async (req) => {
  await req.respond({
    status: 200,
    headers: new Headers({
      "content-type": "text/html; charset=UTF-8",
    }),
    body: ReactDOMServer.renderToString(
      <html>
        <head>
          <meta charSet="utf-8" />
          <title>servest</title>
        </head>
        <body>Hello Servest!</body>
      </html>,
    ),
  });
});
app.listen({ port: 8899 });
展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论

点击加入讨论🔥(11) 发布并加入讨论🔥
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
11 评论
40 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部