This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const serverless = require("serverless-http"); | |
const express = require("express"); | |
const app = express(); | |
app.get("/", (req, res, next) => { | |
return res.status(200).json({ | |
message: "Hello from root!", | |
}); | |
}); | |
app.get("/hello", (req, res, next) => { | |
return res.status(200).json({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: pdf-generator | |
frameworkVersion: '3' | |
provider: | |
name: aws | |
runtime: nodejs14.x | |
region: ap-south-1 | |
stage: ${opt:stage, 'dev'} | |
timeout: 28 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chromium = require('chrome-aws-lambda'); | |
const playwright = require('playwright-core'); | |
const serverless = require("serverless-http"); | |
const express = require("express"); | |
const app = express(); | |
app.get("/", async function (req, res) { | |
let browser = null; | |
var resp = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chromium = require('chrome-aws-lambda'); | |
const playwright = require('playwright-core'); | |
const serverless = require("serverless-http"); | |
const express = require("express"); | |
const app = express(); | |
app.get("/", async function (req, res) { | |
let browser = null; | |
var resp = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!req.query?.url) | |
throw Error("Url not present in query") | |
await page.goto(req.query.url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
functions: | |
hello: | |
handler: index.handler | |
events: | |
- httpApi: | |
path: / | |
method: POST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post("/", async function (req, res) { | |
return res.status(400).json({data: 'hello world'}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type="text/css"> | |
#header { | |
padding: 0 !important; | |
} | |
.content { | |
width: 100%; | |
height: 12px; | |
background-color: #42a5f6; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const templateHeader = fs.readFileSync('header.html','utf-8'); | |
const templateFooter = fs.readFileSync('footer.html','utf-8'); | |
const data = await page.pdf({ | |
displayHeaderFooter: true, | |
headerTemplate: templateHeader, | |
footerTemplate: templateFooter, | |
margin: { | |
top: '16px', | |
bottom: '36px', | |
}, |
OlderNewer