Skip to content

Instantly share code, notes, and snippets.

View ajaykarthikr's full-sized avatar
🚀
Shipping things!

Ajay Karthik ajaykarthikr

🚀
Shipping things!
View GitHub Profile
const express = require('express')
var cors = require('cors')
const app = express();
app.use(cors())
functions:
hello:
handler: index.handler
events:
- httpApi:
path: /
method: POST
- httpApi:
path: /
method: OPTIONS
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',
},
<html>
<head>
<style type="text/css">
#header {
padding: 0 !important;
}
.content {
width: 100%;
height: 12px;
background-color: #42a5f6;
app.post("/", async function (req, res) {
return res.status(400).json({data: 'hello world'})
});
functions:
hello:
handler: index.handler
events:
- httpApi:
path: /
method: POST
if(!req.query?.url)
throw Error("Url not present in query")
await page.goto(req.query.url);
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 = {}
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 = {}