Line data Source code
1 : // @ts-check 2 : const 3 1 : Server = require('./Server'); 4 : 5 1 : const config = require('./config'); 6 : 7 1 : var server = new Server(config); 8 : 9 1 : if (require.main === module) { 10 0 : (async function() { 11 : /* we're called as a main, let's listen */ 12 0 : await server.listen(() => { 13 0 : console.log(`Server listening on port http://localhost:${config.port}`); 14 : }); 15 : }()); 16 : 17 : } 18 : else { 19 : /* export our server */ 20 1 : module.exports = server; 21 : }