- Convert Express app to Vercel serverless function - Add missing /api/files/public endpoint - Optimize static file routing with proper caching - Remove unnecessary dependencies for faster cold starts - Add comprehensive debugging and error handling - Improve API response times and user experience
60 lines
1.0 KiB
JSON
60 lines
1.0 KiB
JSON
{
|
|
"version": 2,
|
|
"builds": [
|
|
{
|
|
"src": "api/simple.js",
|
|
"use": "@vercel/node"
|
|
}
|
|
],
|
|
"routes": [
|
|
{
|
|
"src": "/api/(.*)",
|
|
"dest": "/api/simple.js"
|
|
},
|
|
{
|
|
"src": "/health",
|
|
"dest": "/api/simple.js"
|
|
},
|
|
{
|
|
"src": "/(.*\\.(css|js|json|svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot|html))",
|
|
"headers": {
|
|
"Cache-Control": "public, max-age=31536000, immutable"
|
|
},
|
|
"dest": "/$1"
|
|
},
|
|
{
|
|
"src": "/index\\.html",
|
|
"headers": {
|
|
"Cache-Control": "public, max-age=0, must-revalidate"
|
|
},
|
|
"dest": "/index.html"
|
|
},
|
|
{
|
|
"src": "/admin/(.*)",
|
|
"dest": "/admin/$1"
|
|
},
|
|
{
|
|
"src": "^/$",
|
|
"dest": "/api/simple.js"
|
|
},
|
|
{
|
|
"src": "/(.*)",
|
|
"dest": "/index.html"
|
|
}
|
|
],
|
|
"headers": [
|
|
{
|
|
"source": "/api/(.*)",
|
|
"headers": [
|
|
{
|
|
"key": "Cache-Control",
|
|
"value": "public, max-age=0, s-maxage=86400"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"env": {
|
|
"NODE_ENV": "production"
|
|
}
|
|
}
|