Listen on HTTP and HTTPS for a single express app

后端 未结 6 684
时光取名叫无心
时光取名叫无心 2020-12-02 09:36

Can I create an Express server listening on both HTTP and HTTPS, with the same routes and the same middlewares?

Currently I do this with Express on HTTP, with stunne

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 10:23

    Similar post

    Can I configure expressjs to serve some pages over http and others over https?

    Be aware that express now support creating Https servers with:

     var app = require('express').createServer({ key: ... });
    

提交回复
热议问题