Debug and test an endpoint
While developing your endpoint, you can test it locally to check if it works as expected.
Run locally
To run your endpoint locally, do the following:
-
Run the following Netlify SDK command to start a local development server:
This provides you with a URL to access the local development server. For example, at
http://localhost:8888
. -
Test your endpoint by sending requests to
/.netlify/functions/your-endpoint-name
. If your server is atlocalhost:8888
, then you can test it athttp://localhost:8888/.netlify/functions/your-endpoint-name
.
If your extension calls endpoints from extension UI, you may also want to review the doc on how to develop and preview extension UI locally.
Debug
All console.log
statements are output to the terminal where you ran the preview
command. This is useful for debugging your endpoint.
Next steps
When you’re ready, you can publish your extension as a private extension and test it with a site in production.