diff --git a/package.json b/package.json index 834ed25..a782485 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "dependencies": { "express": "^4.16.4", "sqlite3": "*", - "sequelize": "*" + "sequelize": "*", + "request": "^2.88.0" }, "engines": { "node": "10.x" @@ -26,4 +27,4 @@ "glitch", "express" ] -} +} \ No newline at end of file diff --git a/server.js b/server.js index e6ac12d..496cf46 100644 --- a/server.js +++ b/server.js @@ -4,6 +4,7 @@ // init project var express = require('express'); var Sequelize = require('sequelize'); +var request = require('request'); var app = express(); // setup a new database @@ -69,6 +70,19 @@ app.get('/newreading', (req, res) => { res.status(200).send('Reading received: ' + req.query.v).end(); }); +app.get('/import', (req, res) => { + request({ url: 'https://www.jasonsplant.ml/extract', json: true }, (error, {body}) => { + if (error) return; + else { + body.foreach((item) => { + console.log(item) + }) + + res.status(200).send(body).end(); + } + }) +}) + // listen for requests :) const listener = app.listen(process.env.PORT, function() { console.log("Your app is listening on port " + listener.address().port); diff --git a/shrinkwrap.yaml b/shrinkwrap.yaml index 89b62bf..c827eca 100644 --- a/shrinkwrap.yaml +++ b/shrinkwrap.yaml @@ -1,5 +1,6 @@ dependencies: express: 4.16.4 + request: 2.88.0 sequelize: 5.21.3 sqlite3: 4.1.1 packages: @@ -1238,5 +1239,6 @@ shrinkwrapMinorVersion: 9 shrinkwrapVersion: 3 specifiers: express: ^4.16.4 + request: ^2.88.0 sequelize: '*' sqlite3: '*'