From 2873f6901eaed83824aa0bb4c33c77268bb941b3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 1 Jun 2021 23:26:18 -0700 Subject: remove pino from start command --- index.js | 6 ++++++ lib/rates.js | 3 ++- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6796dbe7..563572f7 100644 --- a/index.js +++ b/index.js @@ -111,3 +111,9 @@ app.use((err, req, res, next) => { server.listen(config.port, () => console.log(`CoinOS Server listening on port ${config.port}`) ); + +process.on("SIGINT", process.exit); + +process.on('uncaughtException', function (exception) { + console.log(exception); +}); diff --git a/lib/rates.js b/lib/rates.js index 80c22bf0..598fc041 100644 --- a/lib/rates.js +++ b/lib/rates.js @@ -9,7 +9,7 @@ let fetchRates; try { ({ date, fx } = JSON.parse(fs.readFileSync("fx"))); - } catch { + } catch(e) { l.warn("Failed to read fx file"); } @@ -30,6 +30,7 @@ let fetchRates; } = await axios.get( `http://data.fixer.io/api/latest?access_key=${config.fixer}` ); + let USD = fx["USD"]; Object.keys(fx).map(k => { fx[k] = parseFloat((fx[k] / fx["USD"]).toFixed(6)); diff --git a/package.json b/package.json index 83b42afa..4c7050b9 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "private": true, "scripts": { - "start": "nodemon index.js | pino-pretty", + "start": "nodemon index.js", "generate": "sequelize-automate -c config/index.js" }, "dependencies": { -- cgit v1.2.3