🚲🏉 Checkpoint

./server.js:7435365/1521
./package.json:7435365/1369
This commit is contained in:
Glitch (hello-express) 2019-12-20 22:12:17 +00:00
parent 78a5b2e6e2
commit 7a9e6b22c5
3 changed files with 19 additions and 2 deletions

View File

@ -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"
]
}
}

View File

@ -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);

View File

@ -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: '*'