Vercel - serverless platform for frontend frameworks and serverless functions.
Here we have an example of how to deploy a Burr application as a Vercel Serverless Function.
npm install -g vercel
Start the local development server:
vercel dev
Send test request to check if the function executes correctly:
curl -X POST "http://localhost:3000/api/counter" \ -H "Content-Type: application/json" \ -d '{"number": 5}'
Expected response:
{"counter": 5, "counter_limit": 5, "__SEQUENCE_ID": 5, "__PRIOR_STEP": "result"}
vercel login
This will open your browser to authenticate with your Vercel account.
Deploy to a preview environment for testing:
vercel
Vercel will provide a preview URL. Test it:
curl -X POST "https://your-project-xxx.vercel.app/api/counter" \ -H "Content-Type: application/json" \ -d '{"number": 5}'
Once preview testing is successful, deploy to production:
vercel --prod
Your production URL will be:
https://your-project.vercel.app
curl -X POST "https://your-project.vercel.app/api/counter" \ -H "Content-Type: application/json" \ -d '{"number": 5}'
View detailed logs:
vercel logs --follow
Ensure your handler file is in the api/ directory with correct format.
The production URL is always in the format: https://your-project.vercel.app
Check your Vercel Dashboard → Domains section for the correct URL.