HoS API is in charge of translating HTTP and HTTPS calls into the HoS environment, it listens to the calls on the web API and sends the call into the appropriate service, after which it will send the reply back into the caller.
You can simply expose an api to your hos environment:
var express = ;var http = ;var bodyParser = ;var hosApi = ;app = ;hosApi;
After running mentioned code you can open any routes for the given service running and get the response.
Lets step further and plug in swagger validation and middlewares to the environment:
var express = ;var http = ;var bodyParser = ;var hosApi = ;var HoSAuth = ;var cors = ;var amqpurl = "localhost"var amqpusername = "guest"var amqppassword = "guest"hosAuth = amqpurl amqpusername amqppasswordhosAuth;hosAuth;
You need to have a running hos-auth, in this example authentication service simply accept all the incoming calls, in hosApi init method you can specify is you require to initialize swagger middlewere and the host address to serve the swaggerui with, hos-api initializes an instance of hos-controller, collecting swagger docs for each service merging them and serve them as once in
/api-docs of your host server address, every 10 minutes by default swagger file for the api gets updated.
YOURSERVER: server address
SERVICE: destination HoS service
TASK: required task from that service
ID(optional): can be used to specify id of resource in specific task
QUERYSTRING(optional): can be used for an query statement recommend to be written as
con1=val1&con2=val2...destination service specify the requirement.
JSON request for destination service, depends on service documentation.
For each calls the timeout of 30 sec has been define which will end up in returning 404 if the call does not have a reply in requested time.
Put the static pages in
views directory and resources in
public directory, making a
GET request if the file exist web server will send the
HTML file to requester.
This software is licensed under the MIT License.