
Val Town Has a Free Serverless API for Running JavaScript in the Cloud
Val Town lets you write and deploy JavaScript/TypeScript functions instantly — no server, no deploy step, no config. Each function gets a URL you can call from anywhere. Create a Val (Function) // @username/myApi — instantly deployed at val.town export default async function ( req : Request ): Promise < Response > { const { name } = await req . json (); return Response . json ({ greeting : `Hello, ${ name } !` }); } Your function is now live at https://username-myapi.web.val.run . HTTP Vals // A full API endpoint export default async function ( req : Request ): Promise < Response > { const url = new URL ( req . url ); if ( req . method === ' GET ' && url . pathname === ' /users ' ) { const users = await fetch ( ' https://jsonplaceholder.typicode.com/users ' ); return Response . json ( await users . json ()); } if ( req . method === ' POST ' && url . pathname === ' /webhook ' ) { const body = await req . json (); console . log ( ' Webhook received: ' , body ); return new Response ( ' OK
Continue reading on Dev.to JavaScript
Opens in a new tab



