caopi
V2EX  ›  Node.js

express 的 app.listen 是废弃了吗?

  •  
  •   caopi · Oct 11, 2018 · 4251 views
    This topic created in 2774 days ago, the information mentioned may be changed or developed.

    之前搞不明白为何要使用 http.createServer(app)代替 app.listen,上网查询看到 app.listen 废弃了?

    所以使用 http.createServer(app )是为什么呢

    4 replies    2018-10-11 14:06:43 +08:00
    caopi
        1
    caopi  
    OP
       Oct 11, 2018
    ```
    app.listen = function listen() {
    var server = http.createServer(this);
    return server.listen.apply(server, arguments);
    };
    ```

    这段源码是什么意思呢
    throns
        2
    throns  
       Oct 11, 2018 via Android
    或许应该去看看 http.createServer().listen 函数的源码
    throns
        3
    throns  
       Oct 11, 2018 via Android
    imherer
        4
    imherer  
       Oct 11, 2018
    有废弃吗?你看的多少版本的? 我看官方 4.x 的文档都还在使用 app.listen 啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   880 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 20:47 · PVG 04:47 · LAX 13:47 · JFK 16:47
    ♥ Do have faith in what you're doing.