connected

2019-02-12 admin

connected是什么

什么是connected,Error first callback for listening on the server.

connected使用教程帮助文档

connected

This module is born out of an annoyance with the Node core. Every method that receives a callback is called using an error first callback. But this is not the case with servers. When you tell the server to start listening on the given port it can will emit an error event when it failed.

Installation

npm install connected --save

Usage

var connected = require('connected')
  , http = require('http');

var app = http.createServer(function (req, res) {
  res.end('wobble wobble');
});

connected(app, 80, function (err) {
  // Received an error because we are not allowed to listen on port 80
});

And thats it.

License

MIT

你可能感兴趣的文章:

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-53571.html

文章标题:connected

回到顶部