aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.js6
-rw-r--r--lib/rates.js3
-rw-r--r--package.json2
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": {