MENU
Server Actions
Designated by the 'use server' directive in Next.js, a server action is an async function that is initiated on the client but executed on the server.
Instead of invoking a route handler via the API end-point defined for a specific URL, you can also execute a server action while the visitor is navigating around your web application on the browser.
Under the hood, server actions use the HTTP method POST, integrating with the Next.js caching and revalidation architecture.
To ensure a server action is indeed running on the server, check that when you call console.log(), it logs to the server terminal and not on the browser developer tools interface (F12).