From 7a9e6b22c503b65db8577c7af5743030cc3af890 Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Fri, 20 Dec 2019 22:12:17 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B2=F0=9F=8F=89=20Checkpoint=20./serve?= =?UTF-8?q?r.js:7435365/1521=20./package.json:7435365/1369?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +++-- server.js | 14 ++++++++++++++ shrinkwrap.yaml | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) 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: '*'