Archived
pusho1
This commit is contained in:
+12
-7
@@ -78,11 +78,16 @@ low(new FileAsync(__dirname + '/db.json')) // production
|
|||||||
res.set({
|
res.set({
|
||||||
'Access-Control-Allow-Origin': '*'
|
'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) {
|
if (req.query.prevId) {
|
||||||
|
console.log(videos.length)
|
||||||
let tmp = [];
|
let tmp = [];
|
||||||
for (let i = 0; i < videos.lenght; i++) {
|
for (let i = 0; i < videos.length; i++) {
|
||||||
for (let j = 0; i < videos[i].reason.lenght; j++) {
|
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) {
|
if (videos[i].reason[j].prevId === req.query.prevId) {
|
||||||
let tmp2 = {
|
let tmp2 = {
|
||||||
...videos[i].reason[j],
|
...videos[i].reason[j],
|
||||||
@@ -152,9 +157,9 @@ low(new FileAsync(__dirname + '/db.json')) // production
|
|||||||
return db.defaults({ videos: [] }).write();
|
return db.defaults({ videos: [] }).write();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
app.use(express.static(__dirname + '/build')); // serve static build site
|
//app.use(express.static(__dirname + '/build')); // serve static build site
|
||||||
app.get('*', (req, res) => {
|
//app.get('*', (req, res) => {
|
||||||
res.sendFile(__dirname + '/build/index.html');
|
// res.sendFile(__dirname + '/build/index.html');
|
||||||
});
|
//});
|
||||||
app.listen(8000, () => console.log('listen on 8000')); // bind to port 8000 as required from specs
|
app.listen(8000, () => console.log('listen on 8000')); // bind to port 8000 as required from specs
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user