<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          httpbeastNim 實(shí)現(xiàn)的高性能多線程 HTTP 服務(wù)器

          聯(lián)合創(chuàng)作 · 2023-10-01 14:37

          httpbeast 是使用 Nim 語(yǔ)言編寫(xiě)的高性能、多線程 HTTP 1.1 服務(wù)器。

          主要特性

          • 基于 Nimselectors模塊構(gòu)建,可以有效地利用 Linux 上的 epoll 和 macOS 上的 kqueue
          • 自動(dòng)并行化,只需確保編譯時(shí)添加--threads:on參數(shù)即可
          • 支持 HTTP pipelining
          • 按需使用的解析器,可用于僅解析請(qǐng)求的數(shù)據(jù)
          • 與 Nim 的集成asyncdispatch支持在必要時(shí)在請(qǐng)求回調(diào)中使用 async/await

          示例代碼

          創(chuàng)建helloHttp.nimble文件:

          # Package
          
          version       = "0.1.0"
          author        = "Your Name"
          description   = "Your Description"
          license       = "MIT"
          srcDir        = "src"
          bin           = @["helloHttp"]
          
          
          # Dependencies
          
          requires "nim >= 1.0.0"
          requires "httpbeast >= 0.3.0"
          

          創(chuàng)建src/helloHttp.nim文件:

          import options, asyncdispatch
          
          import httpbeast
          
          proc onRequest(req: Request): Future[void] =
            if req.httpMethod == some(HttpGet):
              case req.path.get()
              of "/":
                req.send("Hello World")
              else:
                req.send(Http404)
          
          run(onRequest)

          通過(guò)nimble c -r helloHttp.nim運(yùn)行。

          瀏覽 29
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  欧美三级午夜理伦三级18禁 | 黄色片网站免费观看 | 激情无码一区二区 | 国产在线日本 | 北条麻妃激情视频 |