don't read html file on every html request
This commit is contained in:
parent
d6f198afca
commit
6a38f944a6
1 changed files with 5 additions and 2 deletions
|
@ -152,10 +152,13 @@ async function getClaimFromChainquery(url) {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
let html;
|
||||
async function getHtml(ctx) {
|
||||
const html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8');
|
||||
const requestPath = decodeURIComponent(ctx.path);
|
||||
if (!html) {
|
||||
html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8');
|
||||
}
|
||||
|
||||
const requestPath = decodeURIComponent(ctx.path);
|
||||
if (requestPath.length === 0) {
|
||||
const ogMetadata = buildBasicOgMetadata();
|
||||
return insertToHead(html, ogMetadata);
|
||||
|
|
Loading…
Reference in a new issue