I was reading the documentation from the net module in Node.js and I can't see any difference between the methods net.connect
and net.createConnection
.
Are they exactly the same or is there is some difference?
Connect's extensions are mainly there to make it easy to plug in middleware. That's why Connect describes itself as a "middleware framework," and is often analogized to Ruby's Rack. Express does to Connect what Connect does to the http module: It offers a createServer method that extends Connect's Server prototype.
createServer() may create a Unix domain socket and server.
The server. listen() is an inbuilt application programming interface of class Socket within tls module which is used to start the server to listen the encrypted connection. Parameters: This method takes the following argument as parameter: port: It is the port number.
The Node. js Client uses the MarkLogic REST Client API to communicate with MarkLogic Server, so it uses the same security model.
There's no difference. Here's an extract from the source code:
exports.connect = exports.createConnection = function() {
I agree the documentation isn't clear on that point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With