-
Notifications
You must be signed in to change notification settings - Fork 0
Home
- Api
-
Class representing the client api.
Class representing the client api.
Kind: global class
Create an instance of the Client API.
Param | Type | Default | Description |
---|---|---|---|
projectId | string |
The Project Id. | |
url | string |
"/" |
Base url of space-exec server. |
Example
const { API } = require('space-api-node');
const api = new API('my-project');
Initialse the Client Api with the JWT token
Kind: instance method of Api
Param | Type | Description |
---|---|---|
token | string |
The signed JWT token received from the server on successful authentication. |
Set the new Project Id
Kind: instance method of Api
Param | Type | Description |
---|---|---|
projectId | string |
The Project Id. |
api.Mongo() ⇒ Mongo
Returns a MongoDB client instance
Kind: instance method of Api
Returns: Mongo
- MongoDB client instance
api.Postgres() ⇒ SQL
Returns a SQL client instance
Kind: instance method of Api
Returns: SQL
- SQL client instance
api.MySQL() ⇒ SQL
Returns a SQL client instance
Kind: instance method of Api
Returns: SQL
- SQL client instance
Calls a function from Function as a Service Engine
Kind: instance method of Api
Returns: Promise
- Returns a promise
Param | Type | Default | Description |
---|---|---|---|
engineName | string |
The name of engine with which the function is registered | |
funcName | string |
The name of function to be called | |
params | Object |
The params for the function | |
[timeout] | string |
5000 |
Timeout in milliseconds |
Example
api.call('my-engine', 'my-func', { msg: 'Function as a Service is awesome!' }, 1000)
.then(res => {
if (res.status === 200) {
// res.data contains the response given by the function
console.log('Response:', res.data);
return;
}
}).catch(ex => {
// Exception occured while processing request
});
The MongoDB Client Interface.
Kind: global external
See: https://github.com/spaceuptech/space-api-node/wiki/Mongo
The SQL Client Interface.
Kind: global external
See: https://github.com/spaceuptech/space-api-node/wiki/SQL