Skip to content

Commit 78990f2

Browse files
test(deployment): netlify
1 parent 06341e8 commit 78990f2

1 file changed

Lines changed: 28 additions & 8 deletions

File tree

netlify.toml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
1+
# Global build environment settings
12
[build.environment]
2-
NODE_VERSION = "20"
3-
SECRETS_SCAN_OMIT_KEYS = "VITE_API_URL,VITE_GEOAPIFY_API_KEY"
3+
NODE_VERSION = "20"
4+
PNPM_VERSION = "8" # Good practice to specify the pnpm version
5+
SECRETS_SCAN_OMIT_KEYS = "VITE_API_URL,VITE_GEOAPIFY_API_KEY"
46

7+
# --- Frontend App Build Configuration ---
8+
# This tells Netlify how to build your static React application.
59
[build]
6-
base = "frontend"
7-
command = "pnpm install && pnpm run build"
8-
publish = "dist"
10+
base = "frontend" # Netlify will `cd` into the 'frontend' directory first.
11+
command = "pnpm install && pnpm run build" # Then, it runs the build command for your React app.
12+
publish = "frontend/dist" # The output directory for the static site, relative to the repo root.
913

14+
# --- Serverless Functions Configuration ---
15+
# This tells Netlify where to find your backend API endpoints.
16+
[functions]
17+
directory = "netlify/functions" # Directory for serverless functions, relative to the repo root.
18+
19+
# --- Redirects and Rewrites ---
20+
21+
# This rule makes your serverless function available at a cleaner URL.
22+
# Instead of calling `/.netlify/functions/predict`, your frontend can call `/api/predict`.
23+
[[redirects]]
24+
from = "/api/*"
25+
to = "/.netlify/functions/:splat"
26+
status = 200
27+
28+
# This rule is crucial for Single-Page Applications (SPAs) like React.
29+
# It ensures that all paths are served by index.html, allowing React Router to work.
1030
[[redirects]]
11-
from = "/*"
12-
to = "/index.html"
13-
status = 200
31+
from = "/*"
32+
to = "/index.html"
33+
status = 200

0 commit comments

Comments
 (0)