gbox-apis
v3.1.13
Published
An Gbox API's npm Package for Node.js and Sails.js
Downloads
21
Readme
Build as support for GaussBox API. Works with Sails.js only.
New API's automatically check-in to all GaussBox API's, retrieve info about all API's and many more.
Install
$ npm install --save gbox-apis
Usage
Package requires database configuration on initialisation.
let dbConfig = {
host: "********",
port: "********",
user: "********",
password: "********",
database: "********"
};
const Gbox = require('gbox-apis')(dbConfig);
For checking in, routes array must be sent.
let routes = [
{
actionName: "String field, descriptive action name, user friendly. This is seen by user when creating permissions.",
action: "String field, action name, aka user_create. Multiword actions is divided by underscore.",
type: "String field. Read dev documentation for action types.",
visibility: "Array of strings, it is optional. Read dev documentation for visibility types.",
level: "Array of strings, it is optional. Read dev documentation for level types.",
controllerActions: "Array of strings, it is optional. Read dev documentation for controllerActions.",
routeVersion: "String field, route version aka v1",
routeMethod: "String field, HTTP method",
route: "String field, starts with slash and folowed by API url."
},
...
];
Calling checkIn method. Controller actions is optional.
Gbox.checkIn(routes);
Getting api data with list of available actions.
// to get Apis data
Gbox.getData();
Dependency
To check-in API, package.json must have this properties:
"name": "service-api",
"descriptiveName": "Service API",
"version": "1.0.0",
"description": "Short API description.",
URL to API is provided in node environment. If not set, API would be checked in with localhost IP.
process.env.homepage = "127.0.0.1:2222";