Hosting Iconify API
This documentation is for the Node.js version of Iconify API.
To install API, first clone or download Iconify API from GitHub: https://github.com/iconify/api.
First, you need to install NPM dependencies and run build script:
npm run build
Then you can start server:
npm run start
By default, server will:
You can customise API to:
- Serve custom icon sets, loaded from various sources.
- Run on a different port.
- Disable search engine if you do not need it, reducing memory usage.
It is recommended that you do not run API on port 80. Server can handle pretty much anything, but it is still not as good as a dedicated solution such as nginx.
Run API on obscure port, hidden from outside world with firewall rules, use nginx as reverse proxy.
HTTPS is not supported. It is a very resource intensive process, better handled by a dedicated solution such as nginx. Use nginx to run as HTTP and HTTPS server, forward queries to API HTTP server on hidden port such as default port 3000.
There are several ways to change configuration:
- Editing files in src/config/, then rebuilding script. This is required for some advanced options, such as using API with custom icons.
- Using environment variables, such as PORT=3100 npm run start.
- Using .env file to store environment variables.
See Iconify API configuration for details.
To start server, run
npm run start
To make sure API runs without interruption, use pm2 or similar Node.js process manager to run application.
It will automatically restart API if something goes wrong and will automatically start API if server is restarted. Sometimes host server might restart for whatever reason, this will make sure API is always running.