Skip to content

Commit 50142fb

Browse files
committed
fix: restructure for Vercel - root api/ + vercel.json functions config
1 parent c91162c commit 50142fb

6 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎api.py‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎api/roast.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""Vercel serverless function entry point."""
2+
import sys
3+
import os
4+
5+
# Ensure web/ is importable
6+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
7+
8+
from web.api.roast import handler # noqa: F401, E402

‎pyproject.toml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,3 @@ roast = "roast.cli:app"
2525
[tool.pytest.ini_options]
2626
pythonpath = ["."]
2727
testpaths = ["tests"]
28-
29-
[tool.vercel]
30-
entrypoint = "api:handler"

‎vercel.json‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"installCommand": "cd web && npm install",
33
"buildCommand": "cd web && npm run build",
44
"outputDirectory": "web/.next",
5+
"functions": {
6+
"api/roast.py": {
7+
"maxDuration": 60
8+
}
9+
},
510
"rewrites": [
611
{
7-
"source": "/gallery",
8-
"destination": "/web/.next/server/app/gallery.html"
9-
},
10-
{
11-
"source": "/roast/:id",
12-
"destination": "/web/.next/server/app/roast/[id]/page.html"
12+
"source": "/api/:path*",
13+
"destination": "/api/roast.py"
1314
}
1415
]
1516
}

‎web/__init__.py‎

Whitespace-only changes.

‎web/api/__init__.py‎

Whitespace-only changes.

0 commit comments

Comments
 (0)