Chrome-performance-bug-mute.../node_modules/tiny-server/bin/index
2023-02-18 18:51:49 +01:00

24 lines
645 B
JavaScript

#!/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);
});