Add a contact form to a Nuxt 3 site
Handle form submissions in a Nuxt 3 app using a server API route or client fetch.
- 1
Create a server API route
Add `server/api/contact.post.ts` that reads the body and POSTs it to FormLoom.
- 2
Call it from the component
Use `useFetch` or `$fetch` to POST to your `/api/contact` route from the Vue component.
- 3
Show success / error state
Handle the FormLoom response and show the user a confirmation.
FAQ
Not necessarily — a static Nuxt site can POST directly to FormLoom from the browser. A server route adds server-side validation.