From 5f99b8e36d22a54a6a5ef17b43c1b3c33e560cef Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Sun, 29 Dec 2019 00:24:49 -0500 Subject: Add index.html template with route for integration --- src/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts index 7d018fe..6749ae1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,7 +38,17 @@ const bashTemplate = { outputFile: path.join(HOST_DIR, "bash"), context: { TARGET_URL } } as Template; +const indexTemplate = { + inputFile: path.join(__dirname, "..", "public", "index.html.template"), + outputFile: path.join(HOST_DIR, "index.html"), + context: { TARGET_URL } +} as Template; + processTemplate(bashTemplate) + .then(template => { + logger.debug("Generated '%s' from template file", template.outputFile); + }) + .then(() => processTemplate(indexTemplate)) .then(template => { logger.debug("Generated '%s' from template file", template.outputFile); }) @@ -48,6 +58,7 @@ processTemplate(bashTemplate) // if the output file exists, then we are fine with continuing without return fs.promises.access(bashTemplate.outputFile, fs.constants.R_OK); }) + .then(() => fs.promises.access(indexTemplate.outputFile, fs.constants.R_OK)) .catch(err => { logger.error("Cannot proceed: %s", err); -- cgit