Debug and test an API handler
While developing your API handler, you can test it locally to check if it works as expected.
Run locally
To run your API handler locally, do the following:
-
Run the following Netlify SDK utility tools command to start a local development server:
This provides you with a URL to access the local development server:
http://localhost:8899
. -
Test your API handler by sending requests to
http://localhost:8899/.netlify/functions/handler/your-api-handler-name
.
Debug
All console.log
statements are output to the terminal where you ran the preview
command. This is useful for debugging your API handler.
Next steps
When you’re ready, you can publish your integration as a private integration and test it with a site in production.