Get information and get/post for cogs running under cog-server.
Include it in your code:
const discover = require('@cisl/crun-discover');
// or typescript
import discover from '@cisl/crun-discover';
Find cogs by id
discover.find('<cog-id>'.then((cogs) => {
// code
});
Find one cog by id
discover.findOne('<cog-id>').then((cog) => {
// code
});
POST request to the cog
cog.httpPost(path, data).then((response) => {
// code
});
GET request from the cog
cog.httpGet(path).then((response) => {
// code
});
GET directly from one cog
discover.findOneAndGet('<cog-id>', path).then((response) => {
// code
});
POST directly to one cog
discover.findOneAndPost('<cog-id>', path, data).then((response) => {
// code
});
Advanced find queries could be used instead of cog-id.
discover.find({ 'cogs.tags': 'red' }).then(cogs => {
// code
});