Я пишу приложение Node.js и пытаюсь использовать функции из моего файла index.js внутри контроллера call.js.Всякий раз, когда я добавляю
var IndexBot = require('/root/afstudeerwerk/chatbotPIROS/index');
в мой файл Call.JS, я получаю следующую ошибку: error1:
![error1](https://i.stack.imgur.com/HXXpH.png)
rout.js (/ root/ afstudeerwerk / chatbotApi / api / маршруты):
'use strict';
module.exports = function(app) {
var chatbot = require('/root/afstudeerwerk/chatbotPIROS/calls');
app.post('/slack/receive',chatbot.create_a_message);
app.post('/DBcheck/:id',chatbot.checkUserAuth);
};
Call.JS (/ root / afstudeerwerk / chatbotPIROS / звонки)
'use strict';
exports.create_a_message = function(req, res) {
var IndexBot = require('/root/afstudeerwerk/chatbotPIROS/index');
var message = req.body;
var button = JSON.parse(message.payload).actions[0].value
if(button == 'MeanMakeVM'){
res.json({message:'Please enter your VM specs.'});
IndexBot.stuur_bot_bericht('dit is een testbericht.');
}