Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better messages for Eve server #553

Merged
merged 3 commits into from
Nov 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const contentTypes = {
}

const BROWSER = !argv["server"];
const PORT = process.env.PORT || 8080;
const PORT = process.env.PORT || argv["port"] || 8080;
const serverDatabase = new ServerDatabase();
const shared = new PersistedDatabase();

Expand Down Expand Up @@ -162,5 +162,13 @@ let wss = new WebSocketServer({server: server});
initWebsocket(wss);

server.listen(PORT, function(){
console.log("Server listening on: http://localhost:%s", PORT);
console.log(`Eve is available at http://localhost:${PORT}. Point your browser there to access the Eve editor.`);
});

// If the port is already in use, display an error message
process.on('uncaughtException', function(err) {
if(err.errno === 'EADDRINUSE') {
console.log(`ERROR: Eve couldn't start because port ${PORT} is already in use.\n\nYou can select a different port for Eve using the "port" argument.\nFor example:\n\n> npm start -- --port 1234`);
}
process.exit(1);
});