diff --git a/server/server.js b/server/server.js index 7a45bcb..d526eee 100644 --- a/server/server.js +++ b/server/server.js @@ -1,4 +1,4 @@ -const query = require("./queries/query"); +const utils = require("./utils/utils"); const express = require("express"); const app = express(); const cors = require("cors"); @@ -19,4 +19,8 @@ app.listen(port, () => { console.log(`Server is running on port: ${port}`); }); -query.getSingleStockInfo("AAPL"); +utils.getSingleStockInfo("AAPL"); + +const test = new Date("2015-03-25"); +const ans = utils.dateToEpoch(test); +console.log(ans); diff --git a/server/queries/query.js b/server/utils/utils.js similarity index 88% rename from server/queries/query.js rename to server/utils/utils.js index 1ed8f46..d8ee6db 100644 --- a/server/queries/query.js +++ b/server/utils/utils.js @@ -1,3 +1,4 @@ +//For web scraping const axios = require("axios"); module.exports = { @@ -21,4 +22,8 @@ module.exports = { return resolve(res); }).catch(err => reject(err)); }), + dateToEpoch: date => { + console.log(date); //Date in GMT + return Math.round(new Date(date).getTime() / 1000.0); + } }