Utilities for web service (rest)

Web service utilities are designed to implement the processing of various types of requests to the server.

The service connects to the application in deploy.json in the modules.rest.globals.di object, for example like this:

  "modules": {
    "rest": {
      "globals": {
        "di": {
          "acceptor": {
            "module": "modules/rest/lib/impl/acceptor",
            "options": {
              "dataRepo": "ion://dataRepo",
              "metaRepo": "ion://metaRepo"

In this case, the service acceptoris connected , it will be available for requests by url https://dnt.iondv.com/rest/acceptor.

Functional description of interaction with requests should be contained in the script modules/rest/lib/impl/acceptor.js.

In the options field, any variables and their values, which will become available in the script through the fields of the object passed as an argument to the main function of the module, can be specified.

The script is compiled in the module format, for example:

const Service = require('modules/rest/lib/interfaces/Service');

/** Simple app service - REST module
 * @param {{dataRepo: DataRepository, metaRepo: MetaRepository}} options
 * @constructor
function EchoRest(options) {
  this._route = function(router) {
    this.addHandler(router, '/', 'POST', (req) => {
      return Promise.resolve({
        echo: 'peekaboo'
    this.addHandler(router, '/', 'GET', (req) => {
      return Promise.resolve({
        echo: 'peekaboo'
EchoRest.prototype = new Service();
module.exports = EchoRest;

A detailed description of the principles of creating the service can be found in https://github.com/iondv/rest/blob/main/README.md/ section Development of the service handler in the app