3 ms·
Sockets and Nodes—An Experiment (Part I)
- substack 16y agoInstead of reading in static files yourself, you can just use connect (or s/connect/express/g and it'll also work): var connect = require('connect'); var server = connect.createServer(connect.staticProvider(__dirname + '/static')).listen(4000); Pow, that was easy! Plus, since connect (and express) are just up the prototype chain from http.Server, it works great with socket.io.
- DTrejo 16y agoanother option is cloudhead's node-static: https://github.com/cloudhead/node-static https://github.com/cloudhead/node-static