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,