blinky/blinky.js

29 lines
676 B
JavaScript
Raw Normal View History

2021-04-06 16:41:49 +02:00
// requirements
const blinkstick = require('./libs/blinkstick');
const server = require('./libs/server');
const logger = require('./libs/logger');
const packageJSON = require('./package');
// start the application
main();
// main - let's get this party started
function main() {
server.start()
.then(logger.info)
.then(server.handleRequests)
.catch(exit);
}
// ... and it all comes crashing down
function exit(err) {
let code = 0;
if (err) {
logger.error(err);
logger.error(packageJSON.name + " ended due to an error");
} else {
logger.info(packageJSON.name + " shutting down gracefully")
}
process.exit(code);
}