mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-07-01 04:46:04 +02:00
Formatting. If latest-canonical.json exists, load it and serve data immediately.
This commit is contained in:
parent
ae8de5ccc2
commit
2e7b783739
9
index.js
9
index.js
|
@ -1,7 +1,14 @@
|
||||||
|
const fs = require("fs");
|
||||||
const analysis = require("./analysis");
|
const analysis = require("./analysis");
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
let items = await analysis.updateData("data");
|
let items = [];
|
||||||
|
if (fs.existsSync("data/latest-canonical.json")) {
|
||||||
|
items = JSON.parse(fs.readFileSync("data/latest-canonical.json"));
|
||||||
|
analysis.updateData("data");
|
||||||
|
} else {
|
||||||
|
items = await analysis.updateData("data");
|
||||||
|
}
|
||||||
setInterval(async () => { items = await analysis.updateData("data") }, 1000 * 60 * 60 * 24);
|
setInterval(async () => { items = await analysis.updateData("data") }, 1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user