
Hattip Has a Free Universal HTTP API That Works on Every Platform
Hattip is a universal HTTP framework that runs the same code on Node.js, Deno, Bun, Cloudflare Workers, Vercel, Netlify, and AWS Lambda — no platform-specific code needed. Core Concept Hattip uses the Web Standard Request/Response API everywhere: import { createRouter } from ' @hattip/router ' ; const app = createRouter (); app . get ( ' / ' , () => { return new Response ( ' Hello from Hattip! ' ); }); app . get ( ' /api/users ' , async () => { const users = await db . getUsers (); return new Response ( JSON . stringify ( users ), { headers : { ' Content-Type ' : ' application/json ' } }); }); app . post ( ' /api/users ' , async ( context ) => { const body = await context . request . json (); const user = await db . createUser ( body ); return new Response ( JSON . stringify ( user ), { status : 201 }); }); export default app ; Deploy Anywhere Same code, different adapters: // Node.js import { createServer } from ' @hattip/adapter-node ' ; createServer ( app ). listen ( 3000 ); // Clou
Continue reading on Dev.to Webdev
Opens in a new tab



