🚲🏉 Checkpoint
./server.js:7435365/1521 ./package.json:7435365/1369
This commit is contained in:
parent
78a5b2e6e2
commit
7a9e6b22c5
@ -12,7 +12,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.16.4",
|
"express": "^4.16.4",
|
||||||
"sqlite3": "*",
|
"sqlite3": "*",
|
||||||
"sequelize": "*"
|
"sequelize": "*",
|
||||||
|
"request": "^2.88.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "10.x"
|
"node": "10.x"
|
||||||
@ -26,4 +27,4 @@
|
|||||||
"glitch",
|
"glitch",
|
||||||
"express"
|
"express"
|
||||||
]
|
]
|
||||||
}
|
}
|
14
server.js
14
server.js
@ -4,6 +4,7 @@
|
|||||||
// init project
|
// init project
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var Sequelize = require('sequelize');
|
var Sequelize = require('sequelize');
|
||||||
|
var request = require('request');
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
// setup a new database
|
// setup a new database
|
||||||
@ -69,6 +70,19 @@ app.get('/newreading', (req, res) => {
|
|||||||
res.status(200).send('Reading received: ' + req.query.v).end();
|
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 :)
|
// listen for requests :)
|
||||||
const listener = app.listen(process.env.PORT, function() {
|
const listener = app.listen(process.env.PORT, function() {
|
||||||
console.log("Your app is listening on port " + listener.address().port);
|
console.log("Your app is listening on port " + listener.address().port);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
express: 4.16.4
|
express: 4.16.4
|
||||||
|
request: 2.88.0
|
||||||
sequelize: 5.21.3
|
sequelize: 5.21.3
|
||||||
sqlite3: 4.1.1
|
sqlite3: 4.1.1
|
||||||
packages:
|
packages:
|
||||||
@ -1238,5 +1239,6 @@ shrinkwrapMinorVersion: 9
|
|||||||
shrinkwrapVersion: 3
|
shrinkwrapVersion: 3
|
||||||
specifiers:
|
specifiers:
|
||||||
express: ^4.16.4
|
express: ^4.16.4
|
||||||
|
request: ^2.88.0
|
||||||
sequelize: '*'
|
sequelize: '*'
|
||||||
sqlite3: '*'
|
sqlite3: '*'
|
||||||
|
Loading…
Reference in New Issue
Block a user