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:
2025-08-21 13:25:57 +09:00
parent ce29d6bc3b
commit ec5da4db32
6 changed files with 162 additions and 154 deletions

View File

@@ -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"
}