25 lines
645 B
Text
25 lines
645 B
Text
|
#!/usr/bin/env node
|
||
|
|
||
|
var Server = require("../lib/server");
|
||
|
|
||
|
var argv = process.argv.slice(2);
|
||
|
|
||
|
var cwd = argv[0] || process.cwd();
|
||
|
|
||
|
var port = process.env["PORT"] || 3000;
|
||
|
|
||
|
var server = new Server(cwd);
|
||
|
|
||
|
server.listen(port, function () {
|
||
|
console.log("============= start ============");
|
||
|
console.log(cwd);
|
||
|
console.log("http://localhost:" + port);
|
||
|
}).once("error", function (err) {
|
||
|
if (err.code === "EADDRINUSE") {
|
||
|
console.log("=============== ERROR ===============");
|
||
|
console.error("Port: " + port + " already in use");
|
||
|
console.log("=====================================");
|
||
|
}
|
||
|
process.exit(1);
|
||
|
});
|