MistLiquit commited on
Commit
6e1cb05
·
verified ·
1 Parent(s): 1ec6698

Add landing page

Browse files
Files changed (1) hide show
  1. src/index.js +17 -0
src/index.js CHANGED
@@ -83,6 +83,23 @@ async function installSsrfGuard(page) {
83
  // Health check is public (no auth) so platforms can probe it.
84
  app.get('/health', (_req, res) => res.json({ status: 'ok' }));
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  app.use((req, res, next) => (authorized(req) ? next() : res.status(401).json({ error: 'Unauthorized' })));
87
 
88
  // Shared: validate input, SSRF pre-check, open page, navigate, then `produce` output.
 
83
  // Health check is public (no auth) so platforms can probe it.
84
  app.get('/health', (_req, res) => res.json({ status: 'ok' }));
85
 
86
+ // Public landing page (info only).
87
+ app.get('/', (_req, res) =>
88
+ res.type('html').send(
89
+ `<!doctype html><meta charset="utf-8"><title>PDF API</title>
90
+ <style>body{font-family:system-ui,sans-serif;max-width:640px;margin:60px auto;padding:0 20px;color:#1f2937;line-height:1.6}code{background:#f3f4f6;padding:2px 6px;border-radius:4px}h1{margin-bottom:0}.muted{color:#6b7280}</style>
91
+ <h1>📄 PDF API</h1>
92
+ <p class="muted">HTML/URL to PDF &amp; screenshot API, with a built-in invoice template.</p>
93
+ <h3>Endpoints</h3>
94
+ <ul>
95
+ <li><code>GET /health</code> — status (public)</li>
96
+ <li><code>POST /pdf</code> — HTML / URL / template &rarr; PDF</li>
97
+ <li><code>POST /screenshot</code> — HTML / URL &rarr; PNG or JPEG</li>
98
+ </ul>
99
+ <p class="muted">Protected endpoints require an API key. Available on RapidAPI.</p>`
100
+ )
101
+ );
102
+
103
  app.use((req, res, next) => (authorized(req) ? next() : res.status(401).json({ error: 'Unauthorized' })));
104
 
105
  // Shared: validate input, SSRF pre-check, open page, navigate, then `produce` output.