Skip to content

deno-serve-https 对于deno的低级api的封装,可以启动同时支持http/1.1和http/2的https服务,并且在一个端口上同时支持了http连接升级,websocket,connect方法.

License

Notifications You must be signed in to change notification settings

masx200/deno-serve-https

Folders and files

NameName
Last commit message
Last commit date

Latest commit

76e6764 · Feb 28, 2023

History

48 Commits
Feb 28, 2023
Feb 28, 2023
Jul 6, 2022
Sep 1, 2022
Jul 6, 2022
Jul 6, 2022
Jul 6, 2022
Jul 6, 2022
Jul 6, 2022
Sep 1, 2022
Feb 28, 2023
Jul 6, 2022
Jul 6, 2022
Sep 1, 2022
Jul 6, 2022
Jul 6, 2022
Jul 6, 2022
Feb 28, 2023
Jul 6, 2022
Jul 7, 2022
Feb 28, 2023
Sep 1, 2022
Feb 28, 2023

Repository files navigation

deno-serve-https-http

介绍

deno-serve-https-http

软件架构

serve_https:对于deno的低级api的封装,可以启动同时支持http/1.1http/2https服务,并且在一个端口上同时支持了http连接升级,websocket,connect方法和普通请求.

serve_http:对于deno的低级api的封装,可以启动支持http/1.1http服务,并且在一个端口上同时支持了http连接升级,websocket,connect方法和普通请求.

与标准库的函数的区别:

  1. alpnProtocols:目前是unstableapi.

  2. 由于http/2中每个请求都是独立并发的,而http/1中每个http升级请求都是阻塞连接的,所以请求的处理方式会有所不同.

  3. connect方法的请求,升级upgrade的请求,普通请求request拆分成三个处理函数.

  4. 可以获取到http请求的alpnProtocol来判断是否是http/2请求.

导入方法

import {
    ConnInfo,
    Handler,
    Handlers,
    serve_http,
    serve_https,
    ServeHttpInit,
    ServeHttpsInit,
} from "https://deno.land/x/masx200_deno_serve_https/mod.ts";

使用说明

https://github.com/masx200/deno-serve-https/blob/master/example.ts

deno run --unstable -A example.ts

About

deno-serve-https 对于deno的低级api的封装,可以启动同时支持http/1.1和http/2的https服务,并且在一个端口上同时支持了http连接升级,websocket,connect方法.

Resources

License

Stars

Watchers

Forks

Packages

No packages published