aboutsummaryrefslogtreecommitdiff
path: root/routes/api/screenshot.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/api/screenshot.js')
-rw-r--r--routes/api/screenshot.js24
1 files changed, 0 insertions, 24 deletions
diff --git a/routes/api/screenshot.js b/routes/api/screenshot.js
deleted file mode 100644
index 06340981..00000000
--- a/routes/api/screenshot.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const router = require("express").Router();
-const puppeteer = require("puppeteer");
-const fs = require("fs");
-const yaml = require("yaml");
-const config = yaml.parse(fs.readFileSync("site.config.yml", "utf8"));
-
-router.get("/", async (req, res) => {
- const browser = await puppeteer.launch();
- const page = await browser.newPage();
- page.setViewport({ width: 1920, height: 1080 });
- // Go to the url
- await page.goto(config.url, {
- waitUntil: "networkidle2",
- });
- // Take a screenshot
- const image = await page.screenshot({fullPage : true});
- await browser.close();
- // Send the image as a response
- res.setHeader("Content-Type", "image/png");
- res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
- res.send(image);
-});
-
-module.exports = router;