feat: initial codebase v0.4.1
Some checks failed
Deploy to Staging / build-and-deploy (push) Failing after 9m44s
Some checks failed
Deploy to Staging / build-and-deploy (push) Failing after 9m44s
- Extract complete codebase from running staging pod - Add Dockerfile with multi-stage build for Node.js + Puppeteer - Configure CI/CD workflows for staging and production deployment - Include all source files, configs, and public assets
This commit is contained in:
commit
b58f634318
28 changed files with 5669 additions and 0 deletions
29
src/routes/signup.ts
Normal file
29
src/routes/signup.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { Router } from "express";
|
||||
import { createKey } from "../services/keys.js";
|
||||
import logger from "../services/logger.js";
|
||||
|
||||
export const signupRouter = Router();
|
||||
|
||||
// Simple signup: email → instant API key (no verification for now)
|
||||
signupRouter.post("/free", async (req, res) => {
|
||||
const { email } = req.body;
|
||||
|
||||
if (!email || typeof email !== "string" || !email.includes("@")) {
|
||||
res.status(400).json({ error: "Valid email required" });
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const key = await createKey(email.toLowerCase().trim(), "free");
|
||||
logger.info({ email: email.slice(0, 3) + "***" }, "Free signup");
|
||||
res.json({
|
||||
apiKey: key.key,
|
||||
tier: "free",
|
||||
limit: 100,
|
||||
message: "Your API key is ready! 100 free screenshots/month.",
|
||||
});
|
||||
} catch (err: any) {
|
||||
logger.error({ err }, "Signup failed");
|
||||
res.status(500).json({ error: "Signup failed" });
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue