From 890574b195daf41e9fa3c627672686e562e94a69 Mon Sep 17 00:00:00 2001 From: kamycoding Date: Tue, 11 Aug 2026 22:06:46 +0200 Subject: [PATCH] fix: route contact API to Netlify function --- netlify.toml | 6 ++++++ netlify/functions/contact.mts | 1 - netlify/tests/contact.spec.ts | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/netlify.toml b/netlify.toml index d1e6f7d..3e2b6b9 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,6 +2,12 @@ command = "npm run build" publish = "dist/portfolio/browser" +[[redirects]] + from = "/api/contact" + to = "/.netlify/functions/contact" + status = 200 + force = true + [[redirects]] from = "/*" to = "/index.html" diff --git a/netlify/functions/contact.mts b/netlify/functions/contact.mts index 1d25d86..32b1f48 100644 --- a/netlify/functions/contact.mts +++ b/netlify/functions/contact.mts @@ -224,7 +224,6 @@ export function createContactHandler( export default createContactHandler(); export const config = { - path: '/api/contact', rateLimit: { windowLimit: 5, windowSize: 180, diff --git a/netlify/tests/contact.spec.ts b/netlify/tests/contact.spec.ts index 4c54be1..2b6c884 100644 --- a/netlify/tests/contact.spec.ts +++ b/netlify/tests/contact.spec.ts @@ -186,9 +186,8 @@ describe('Netlify contact function', () => { expect(response.headers.get('allow')).toBe('POST'); }); - it('maps the function to /api/contact with native per-IP rate limiting', () => { + it('configures native per-IP rate limiting', () => { expect(config).toEqual({ - path: '/api/contact', rateLimit: { windowLimit: 5, windowSize: 180,