You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
641 B

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
  1. #!/usr/bin/env node
  2. var connect = require('connect');
  3. /**
  4. usage:
  5. $ ws <port> <connect-logger-profile>
  6. */
  7. var port = process.argv[2] || 8000,
  8. loggerProfile = process.argv[3] || "dev";
  9. connect.logger.token('date', function(req, res){
  10. var a = new Date();
  11. return (a.getDate() + "/" + a.getUTCMonth() + "/" + a.getFullYear() + ":" + a.toTimeString())
  12. .replace("GMT", "").replace(" (BST)", "");
  13. });
  14. connect()
  15. .use(connect.logger(loggerProfile))
  16. .use(connect.static(process.cwd()))
  17. .use(connect.directory(process.cwd()))
  18. .listen(port);
  19. process.stderr.write("listening on port " + port + "\n");