This commit is contained in:
matteo
2019-03-03 20:42:01 +01:00
parent 12f375afed
commit d9d6138fd9
+12 -7
View File
@@ -78,11 +78,16 @@ low(new FileAsync(__dirname + '/db.json')) // production
res.set({
'Access-Control-Allow-Origin': '*'
});
const videos = db.get('videos');
const videos1 = db.get('videos').values();
let videos = JSON.parse(JSON.stringify(videos1));
console.log(req.query.prevId)
if (req.query.prevId) {
console.log(videos.length)
let tmp = [];
for (let i = 0; i < videos.lenght; i++) {
for (let j = 0; i < videos[i].reason.lenght; j++) {
for (let i = 0; i < videos.length; i++) {
console.log(videos[i]);
for (let j = 0; j < videos[i].reason.length; j++) {
console.log(videos[i].reason[j])
if (videos[i].reason[j].prevId === req.query.prevId) {
let tmp2 = {
...videos[i].reason[j],
@@ -152,9 +157,9 @@ low(new FileAsync(__dirname + '/db.json')) // production
return db.defaults({ videos: [] }).write();
})
.then(() => {
app.use(express.static(__dirname + '/build')); // serve static build site
app.get('*', (req, res) => {
res.sendFile(__dirname + '/build/index.html');
});
//app.use(express.static(__dirname + '/build')); // serve static build site
//app.get('*', (req, res) => {
// res.sendFile(__dirname + '/build/index.html');
//});
app.listen(8000, () => console.log('listen on 8000')); // bind to port 8000 as required from specs
});