2 points | by medvedevil 4 months ago ago
1 comments
Express is the most popular Node.js framework but it was created before TypeScript existed.
APIs are contracts. So why are Express contracts written in invisible ink?
Meaning: - req.body → could be literally anything - res.json() → returns whatever you hand it - TypeScript → just shrugs and says: any
So I built Meebo to fix this.
const router = TypedRouter(express.Router());
const schema = z.object({ id: z.number() })
router.post("/users", { response: schema }, (req, res) => { res.json({ id: 1 }); <--- this is now validated and typed });
You get: - Real TypeScript types from your Zod schemas - Runtime validation on every request - Auto-generated Swagger UI
Express is the most popular Node.js framework but it was created before TypeScript existed.
APIs are contracts. So why are Express contracts written in invisible ink?
Meaning: - req.body → could be literally anything - res.json() → returns whatever you hand it - TypeScript → just shrugs and says: any
So I built Meebo to fix this.
const router = TypedRouter(express.Router());
const schema = z.object({ id: z.number() })
router.post("/users", { response: schema }, (req, res) => { res.json({ id: 1 }); <--- this is now validated and typed });
You get: - Real TypeScript types from your Zod schemas - Runtime validation on every request - Auto-generated Swagger UI