Install the API Gateway
Installation prerequisites
This service provides a REST and oAuth2 development interface so that third-party developers and organizations can create products that interact with the SpinalCore BOS.
To install the API server it is necessary to have the following configuration:
Make sure your SpinalCore installation and the associated extensions are the latest supported versions. (Install your system )
Nodejs + npm installed on your linux distribution
PM2 (process manager) install globally on your server or virtual machine. (Install your system)
Installation & configuration
Once the SpinalCore system is installed, please do the following :
Installation :
Install: npm install https://github.com/spinalcom/spinal-api-gateway.git
Configuration :
In the BOS configuration file : spinal-api-gateway/config.js
The configurations to modify in the file are :
spinalConnector: {
user: process.env.SPINAL_USER_ID || 168, // user id
password: process.env.SPINAL_PASSWORD ||
"3HNvC6fftqHz", // user password
host: process.env.SPINALHUB_IP || "localhost", // can be an ip address
port: process.env.SPINALHUB_PORT || 7777 // port
},
api: {
host: process.env.REQUESTS_HOST || 'localhost', // internal port
port: process.env.REQUESTS_PORT || 3000 // internal port
},
file: {
// path to a digital twin in spinalhub filesystem
path: process.env.SPINAL_DTWIN_PATH || '/__users__/admin/Digital twin',
},
contexts: ['GeographicContext', 'TicketContext', 'BuildingContext']
In the spinal-api-gateway configuration file : spinal-api-gateway/config/gateway.config.yml
The configurations to modify in the file are :
http:
port: 8000
admin:
port: 9889
host: localhost
apiEndpoints:
apiDocs:
paths:
- /api-docs
host: '*'
admin:
paths:
- /admin
host: '*'
serviceEndpoints:
local:
url: 'http://localhost:3000'
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
pipelines: null
Start the system :
Go to the directory containing the information system modules via the console :
spinalcom-system $> pm2 start launch.config.json
Configure of API Gateway
The Configure the API Gateway section describes the Admin UI.