Skip to the content.
Inputs
Parsers
Indexes
Services
Outputs

Configuration - Services

services

Type: Array of Object.Each item in this array must match one of the following definitions.

In RODB, a service is an object through which the outputs are exposed to the outside world. Most commonly, it is a server. Currently, the only type of service that is supported is HTTP, but more will come in the future.

It is possible to define multiple services in the same RODB instance.

Example:

services:
  - name: service
    type: http
    http:
      listen: ":80"
    https:
      listen: ":443"
      certificatePath: "/etc/ssl/certs/example.crt"
      privateKeyPath: "/etc/ssl/certs/example.key"
    errorsType: application/json
    routes:
      - path: "/users"
        output: usersList
      - path: "/users/{id}"
        output: singleUser

HTTP

services[type = “http”]

Type: Object

Creates an HTTP service and provides endpoints bound to the given outputs.

At least one of either the http or https properties must be defined.

Examples:

name: httpService
type: http
http:
  listen: ":80"
routes:
  - path: "/users"
    output: usersList
  - path: "/users/{id}"
    output: singleUser
name: service
type: http
http:
  listen: ":80"
https:
  listen: ":443"
  certificatePath: "/etc/ssl/certs/example.crt"
  privateKeyPath: "/etc/ssl/certs/example.key"
errorsType: application/json
routes:
  - path: "/"
    output: mainOutput

Properties:

name

services[type = “http”].name

Type: String

The name of this service, which any other component will use to refer to it.

type

services[type = “http”].type

Must have the value: "http"

http (optional)

services[type = “http”].http

Type: Object

Makes this service listen to a network interface and TCP port using the HTTP protocol.

Properties:

listen (optional)

services[type = “http”].http.listen

Type: String

Default value: "127.0.0.1:0"

The network interface and TCP port to which the server will listen. The basic format is ip:port. If the port is 0, it will get assigned a random available port. If the IP is omitted(such as :80) or 0.0.0.0, it will listen to the given port number on all interfaces.

For more implementation details, please refer to the net.Dial function of Golang.

https (optional)

services[type = “http”].https

Type: Object

Makes this service listen to a network interface and TCP port using the HTTPS protocol.

Properties:

listen (optional)

services[type = “http”].https.listen

Type: String

Default value: "127.0.0.1:0"

The network interface and TCP port to which the server will listen. The basic format is ip:port. If the port is 0, it will get assigned a random available port. If the IP is omitted(such as :80) or 0.0.0.0, it will listen to the given port number on all interfaces.

For more implementation details, please refer to the net.Dial function of Golang.

certificatePath

services[type = “http”].https.certificatePath

Type: String

The path to the file containing the certificate to use for the TLS connection.

privateKeyPath

services[type = “http”].https.privateKeyPath

Type: String

The path to the file containing the private key to use for the TLS connection.

errorsType (optional)

services[type = “http”].errorsType

Type: String

Default value: "application/json"

The expected output type for the error pages on this server. Currently, only JSON is available.

routes

services[type = “http”].routes

Type: Array of Object. Empty array not allowed.

All the routes to be made available on this service.

Items of the array

services[type = “http”].routes[]

Type: Object

Details of a single endpoint on this service.

Properties:

path

services[type = “http”].routes[].path

Type: String

The path on which the output will be made available on this server (starting with a /). The path can be any string, but the {xxx} (without spaces) placeholders are used to match specific values. The name in those placeholders must match the name of one of the parameters defined in the related output. For example, a placeholder {id} will automatically match with an output parameter called id. Multiple different placeholders are allowed in the same route.

output

services[type = “http”].routes[].output

Type: String

The name of the output object to which this route will be bound.