https://github.com/interopio/rest-config-example-node-js
io.Connect Rest Configuration Service Example in NodeJS- with support for applications and layouts
https://github.com/interopio/rest-config-example-node-js
docs-demos io-connect-desktop nodejs rest typescript
Last synced: 2 days ago
JSON representation
io.Connect Rest Configuration Service Example in NodeJS- with support for applications and layouts
- Host: GitHub
- URL: https://github.com/interopio/rest-config-example-node-js
- Owner: InteropIO
- Created: 2020-04-09T14:05:59.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2026-02-20T16:12:45.000Z (4 months ago)
- Last Synced: 2026-02-20T20:57:14.478Z (4 months ago)
- Topics: docs-demos, io-connect-desktop, nodejs, rest, typescript
- Language: TypeScript
- Homepage:
- Size: 755 KB
- Stars: 3
- Watchers: 3
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# io.Connect Configuration Service Example
⚠️ **Warning:** This is a sample implementation intended for demonstration purposes only. Several aspects would require enhancement for production use in a multi-user environment. Most notably, this sample lacks proper user management and authentication. In a production system, requests should be segregated by user identity, ensuring users can only access their own layouts and data. Currently, this example returns all layouts to any connecting user regardless of identity, which would be inappropriate for a secure multi-user application.
[**io.Connect Desktop**](https://docs.interop.io/desktop/getting-started/what-is-io-connect-desktop/general-overview/index.html) uses application, layout, system and other configurations defined on the local machine, but can also be reconfigured to fetch them from a REST service.
This example project shows how to run a Node.js REST service that provides configuration stores for **io.Connect Desktop**.
## Configuration and Start
To start:
```cmd
# install the dependencies
$ npm i
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
```
This will start the service on port 8004 (by default). You can override the port by setting the `SERVER_PORT` environment variable, as described later in the document.
## REST API Documentation
Once the server is running, you can:
* view the Swagger UI by opening [http://localhost:8004/api](http://localhost:8004/api)
* view the Swagger definition by opening [http://localhost:8004/api-json](http://localhost:8004/api-json) or [http://localhost:8004/api-yaml](http://localhost:8004/api-yaml)
## io.Connect Desktop Configuration
To enable fetching configuration definitions from the REST service, you need to edit your local configuration files located in the `%LOCALAPPDATA%\interop.io\io.Connect Desktop\Desktop\config` folder.
### Applications
To enable fetching application configurations from the REST store, find the `"appStores"` top-level key in the `system.json` file and add a new entry (or replace existing entries) with the following configuration:
```json
{
"appStores": [
{
"type": "rest",
"details": {
"url": "http://localhost:8004/apps/"
}
}
]
}
```
### Layouts
To enable fetching layouts from the REST store, find the `"layouts"` top-level key in the `system.json` file and edit the `"store"` property - change the `"type"` to `"rest"` and assign the URL of the service to the `"restURL"`:
```json
{
"layouts": {
"store": {
"type": "rest",
"restURL": "http://localhost:8004/"
}
}
}
```
### Application Preferences
To enable reading and storing application preference from the REST store, find the `"applicationPreferences"` top-level key in the `system.json` file and edit the `"store"` property - change the `"type"` to `"rest"` and assign the URL of the service to the `"restURL"`:
```json
{
"applicationPreferences": {
"store": {
"type": "rest",
"restURL": "http://localhost:8004/prefs"
}
}
}
```
### System and Other Configurations
To enable io.Connect Desktop to fetch system configurations from a remote location, use the "remoteConfig" top-level key of the `gilding.json` configuration file:
```json
{
"remoteConfig": {
"enabled": true,
"url": "http://localhost:8004/configs",
"wipeFolder": true
}
}
```
## REST Service Env Variables
* SERVER_PORT - The port on which the REST service will run. Defaults to 8004
* APPS_FOLDER - Specifies the directory containing application definitions in JSON format. By default, it points to the `configuration\apps` folder, but the environment variable `APPS_FOLDER` can be used to override * this setting.
* LAYOUTS_FOLDER - Specifies the directory for reading and storing layout definitions. By default, this is set to the `configuration\layouts` folder, but the environment variable `LAYOUTS_FOLDER` can be used to override this setting.
* PREFS_FOLDER - Specifies the directory used for reading and storing application preferences. By default, it points to the `configuration\prefs` folder, but the environment variable `PREFS_FOLDER` can be used to override this setting.
* CONFIGS_FOLDER - Specifies the directory for storing system configurations. By default, it points to the `configuration\configs` folder, but the environment variable `CONFIGS_FOLDER` can be used to override this setting.