fgeorges / mlproj-core

Core implementation of mlproj, everything not TUI-related
Apache License 2.0
1 stars 2 forks source link

Add support for REST app servers #8

Closed fgeorges closed 7 years ago

fgeorges commented 7 years ago

At the moment, mlproj supports HTTP app servers. This proposal is about adding support for app servers with the REST Client API enabled.

They are also HTTP servers, but are created using the endpoint :8002/v1/rest-apis. They cannot use the filesystem for modules. Some components are created automatically if they are not set during creation (e.g. the content database defaults to a new database named {name}-content).

After creation, they can be managed like any other HTTP servers (esp. for all options that cannot be set at creation, you can only set a very few). In addition, a REST app server also expose a handful of extra properties, set yet on a different endpoint.

In environs, a REST server would reuse the same structure as other HTTP servers (and would also be objects in the servers array), with a few differences:

The following properties from both REST server creation and properties endpoints need notes:

An example of a server object would then be (the other properties than those above map rather obviously by name to those in rest-config):

"servers": [{
    "id": "app",
    "name": "@{code}",
    "type": "rest",
    "port": "${port}",
    "content": {
        "idref": "content"
    },
    "modules": {
        "idref": "modules"
    },
    "rest-config": {
        "error-format": "json",
        "xdbc": true,
        "debug": true,
        "tranform-all": true,
        "tranform-out": "tranform-name",
        "update-policy": "version-required",
        "validate-options": false,
        "validate-queries": true
    }
}]