diff options
| author | Bobby <[email protected]> | 2022-07-05 00:23:58 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-07-05 00:23:58 +0530 |
| commit | 406a35de9d0d37d20123a0a3e961614142c2cf3c (patch) | |
| tree | 31299b83e59f02ad08051c7e21655e1895b79106 /routes/api/screenshot.js | |
| parent | de994764b87d2716f951941f26a1044aaca63ed7 (diff) | |
| download | thatcomputerscientist-archived.tar.xz thatcomputerscientist-archived.zip | |
Updarte Screenshot API as a Public Servicearchived
Diffstat (limited to 'routes/api/screenshot.js')
| -rw-r--r-- | routes/api/screenshot.js | 24 |
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; |
