Quantcast
Channel: In node.js do I need http when building a socket.io/express app? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

In node.js do I need http when building a socket.io/express app?

$
0
0

I have just started using node.js and I can build a simple app that responds to requests and has some basic routing using the express framework.

I am looking to create something using socket.io but I am slightly confused over the use of the 'http' module. I understand what http is but I don't seem to need it for the following to work:

var express = require('express');var app = express();app.get('/', function (req, res) {  res.sendFile(__dirname +'/index.htm');});app.listen(3000, function () {  console.log('Example app listening on port 3000!');});

I can serve a html page over http without requiring the http module explicitly with something such as:

var http = require('http');

If I am using express do I have any use for the http module?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images