Examples

Basic

This configuration creates a public api on context /api/svc implemented by pipe api_pipe_01.

{
  "http_context" : "/api",
  "endpoints" : [ {
    "name" : "svc",
    "public": "true",
    "request": {
      "pipe" : "api_pipe"
    }
  } ]
}

Auth

{
  "http_context" : "/api",
  "endpoints" : [ {
    "name" : "svc",
    "auth" : {
      "pipe" : "auth_pipe"
    },
    "request": {
      "pipe" : "api_pipe"
    }
  } ]
}

Template

{
  "http_context" : "/api",
  "endpoints" : [ {
    "name" : "svc",
    "public" : true,
    "auth" : {
      "pipe" : "auth_pipe"
    },
    "request": {
      "pipe" : "api_pipe"
    },
    "response" : {
      "type" : "application/json",
      "template" : "{\n    \"now\": \"{{now}}\",\n    \"count\": {{items.size}},\n    \"elems\": [\n        {{#items}}\n        { \"id\": \"{{id}}\" }\n        {{/items}}\n    ],\n    \"response\": {{{response}}}\n}"
    }
  } ]
}

Custom status

{
  "http_context" : "/api",
  "endpoints" : [ {
    "name" : "svc",
    "public" : true,
    "response" : {
      "pipe" : "api_pipe",
      "status" : [ {
        "regex" : "Custom status.*",
        "value" : 444
      } ]
    }
  } ]
}

Last updated