-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move protofy agents network to another module
- Loading branch information
1 parent
081389d
commit c21d518
Showing
2 changed files
with
27 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/protolib/src/bundles/agents/network/networkApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { API } from "protobase"; | ||
import { AutoAPI, handler, getServiceToken } from 'protonode' | ||
import { getLogger } from 'protobase'; | ||
import { BifrostProtocol } from "../bifrost/bifrost"; | ||
|
||
const logger = getLogger() | ||
|
||
|
||
export const network = (app, context) => { | ||
const agentsPath = '../../data/agents/' | ||
const { topicSub, topicPub, mqtt } = context; | ||
|
||
app.get('/api/core/v1/network', handler(async (req, res, session) => { | ||
if (!session || !session.user.admin) { | ||
res.status(401).send({ error: "Unauthorized" }) | ||
return | ||
} | ||
|
||
res.send("protofy network") | ||
})) | ||
|
||
// agents protocol | ||
BifrostProtocol({ ...context, logger }) | ||
} |