tag:blogger.com,1999:blog-4836497234580815703.post2741397966523880457..comments2023-03-21T17:40:09.049+05:30Comments on It's all abt Tamil: Nodejs Modules and Export ExplainedTamil Selvan Raman Subramaniamhttp://www.blogger.com/profile/03026467443922242454noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-4836497234580815703.post-87754201243496020322012-05-13T23:27:20.236+05:302012-05-13T23:27:20.236+05:30Hi, if you are requiring http twice it means that ...Hi, if you are requiring http twice it means that you are requiring the same exports object cached by node js vm twice. But,<br /><br />exports.createServer = function(requestListener) {<br /> return new Server(requestListener);<br />};<br /><br />Above is the create server function exposed by http module. There you can see "new Server" which means that if you do <br /><br />http.createServer and http2.createServer they should be different<br /><br />Hope this is clearTamil Selvan Raman Subramaniamhttps://www.blogger.com/profile/03026467443922242454noreply@blogger.comtag:blogger.com,1999:blog-4836497234580815703.post-15269858720471603592012-05-13T06:48:15.026+05:302012-05-13T06:48:15.026+05:30Here I see you did a var http = require('http&...Here I see you did a var http = require('http');<br />What if I wanted two different instances of http?<br />Can I do var http2 = require('http'); ?<br />Will http and http2 be new instances?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4836497234580815703.post-32862995827435513972012-05-04T12:08:02.647+05:302012-05-04T12:08:02.647+05:30I'm glad that this post helped you :)I'm glad that this post helped you :)Tamil Selvan Raman Subramaniamhttps://www.blogger.com/profile/03026467443922242454noreply@blogger.comtag:blogger.com,1999:blog-4836497234580815703.post-33684383051473928002012-05-04T06:58:41.443+05:302012-05-04T06:58:41.443+05:30Succinct - the docs did not make this as clear and...Succinct - the docs did not make this as clear and now I refactored my app.js module to be cleaner and free of routes code. Hellooooo unit tests!Anonymousnoreply@blogger.com