@qelos/plugin-netlify-api
v1.0.1
Published
Netlify build plugin: proxy /api/* to Qelos API and inject config
Readme
@qelos/plugin-netlify-api
Netlify build plugin for Qelos frontend apps: proxies /api/* to your Qelos API and injects config.
Setup
In your site’s netlify.toml:
[[plugins]]
package = "@qelos/plugin-netlify-api"Optional: set the API URL (default http://159.203.152.168):
[[plugins]]
package = "@qelos/plugin-netlify-api"
[plugins.inputs]
api_url = "http://159.203.152.168"Or set the QELOS_API_IP environment variable in the Netlify UI (build or runtime).
What it does
- Environment: Sets
QELOS_API_IPfor the build (and for the proxy function at runtime). - Redirect: Adds a rewrite so
/api/*is served by/.netlify/functions/qelos-api-proxy(status 200, force). - Function: Injects a serverless function
qelos-api-proxythat forwards requests to the host/port fromQELOS_API_IP(supports a full URL likehttp://159.203.152.168or a hostname).
No need to add redirects or the function file to your repo; the plugin does it at build time.
