XMPPJS在另一个js文件中使用xmpp



我想用我的strapi API将消息发送到我的XMPP服务器。

我与XMPP的连接在index.js中(我可以在这里发送消息(,我想从我的控制器发送消息,这可能吗?

|index.js
|carrefour/
---|controllers/
---|carrefour.js

在index.js中,我有

module.exports = {
register(/*{ strapi }*/) {},
bootstrap(/*{ strapi }*/) {},
}

但是如果我添加函数或xmpp对象

[2022-10-11 16:54:05.824] error: Invalid file `./src/index.js`: this field has unspecified keys: myfunction

感谢

我找到了一个解决方案。

我创建了一个新的JS,在其中我连接到XMPP,然后导出XMPP变量

最新更新