No description
- JavaScript 100%
|
|
||
|---|---|---|
| node_modules | ||
| .gitignore | ||
| lambda.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| server.js | ||
Screenshot API
REST API that captures screenshots of web pages on demand using Puppeteer (headless Chromium). Returns images as base64-encoded PNGs. Deployed on Railway.
Endpoint
POST /screenshot
Request body (JSON):
{
"url": "https://example.com",
"fullPage": false,
"width": 1280,
"height": 720
}
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
url |
string | yes | — | Page to screenshot |
fullPage |
boolean | no | false |
Capture full scrollable page |
width |
number | no | 1280 |
Viewport width in pixels |
height |
number | no | 720 |
Viewport height in pixels |
Response:
{
"success": true,
"image": "data:image/png;base64,...",
"url": "https://example.com"
}
Deployment
Two entry points are included:
server.js— Standard Express server (Railway, VPS, Docker). Uses bundled Chromium viapuppeteer.lambda.js— AWS Lambda handler. Usespuppeteer-core+@sparticuz/chromiumfor the Lambda runtime.
Development
npm install
npm start # Starts Express server on PORT (default: 3000)
GET / returns the API reference if you need a quick reminder of the endpoint signature.