This service implements a interceptor service used by ingrid services only. Map or transform data using TypeScript.
docker pull registry.goingrid.io/worker/tsinterceptor:v0.1.0
The TSInterceptor does not implement the ingrid protocol message. It is only used by other services to intercept and map or transform data.
Calling a function is done by sending a HTTP request to the TSInterceptor service (e.g https://tsinterceptor/hello
).
### Create user
POST https://tsinterceptor/hello HTTP/1.1
Content-Type: application/json
{
"name": ["Tony"]
}
import { Response, IngridResponse, IngridMsg, IngridResult, IngridData } from "https://raw.githubusercontent.com/itdistrict/ingrid-deno/master/lib/ingrid.ts";
export function hello(type: string, value: any, options: Record<string, string>): IngridResponse {
var resp = new IngridResponse();
let ingMsg : IngridMsg = new IngridMsg();
if (type == "json") {
let ingData: IngridData = {};
ingData["msg"] = ["Hello there " + value.Data.name[0] ];
ingMsg.Data = ingData;
}
resp.options = options;
resp.data = ingMsg;
return resp;
}
Parameter | Default | Description |
---|---|---|
Port | 80 |
Port used to listen to |
BasePath | "/" |
Base path used to prepend to the url (e.g. /tsi) |