mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 08:52:15 -05:00
28 lines
570 B
JavaScript
28 lines
570 B
JavaScript
/**
|
|
* A simple development server for serving static files using node.js
|
|
* Required packages: nodejs, npm
|
|
* 1. npm install express
|
|
* 2. node dev_server.js 8080
|
|
* 3. browse to http://localhost:8080
|
|
*/
|
|
|
|
var express = require('express'),
|
|
port, app;
|
|
|
|
// set port
|
|
if (process.argv[2]) {
|
|
port = process.argv[2];
|
|
} else {
|
|
port = 8080;
|
|
}
|
|
|
|
// Server setup
|
|
app = express();
|
|
app.configure(function(){
|
|
app.use(app.router);
|
|
app.use(express['static'](__dirname));
|
|
});
|
|
|
|
// start server
|
|
app.listen(port);
|
|
console.log(' > listening on http://localhost:' + port); |