Simple File Http Server in NodeJS with Connect


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //Remember to do a basic "npm install connect" before executing
  2. var connect = require('connect');
  3. var port = 3000;
  4. connect.createServer(
  5. connect.static(__dirname)
  6. ).listen(port);
  7.  
  8. console.info("Listening port " + port.toString() + " from: " + __dirname);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.