Fix Vercel serverless deployment: optimize for fast loading
- 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
This commit is contained in:
31
vercel.json
31
vercel.json
@@ -16,14 +16,43 @@
|
||||
"dest": "/api/simple.js"
|
||||
},
|
||||
{
|
||||
"src": "/(.*\\.(html|css|js|json|svg|png|jpg|jpeg|gif|ico|woff|woff2|ttf|eot))",
|
||||
"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"
|
||||
}
|
||||
|
Reference in New Issue
Block a user