2013-03-07 54 views
24

我想將http-post-say.coffee腳本添加到Heroku上託管的hubot應用程序。Add Hub支持Hubot

該文檔指出,一旦添加了該腳本,它將創建'/hubot/say'路由,該路由接受以下格式的發佈請求。

curl -X POST http://localhost:8080/hubot/say -d message=lala -d room='#dev'

我加入了腳本和修改網址,但我收到以下錯誤: Cannot POST /hubot/say

我的下一步是添加一些依賴。我注意到使用robot.router.post的其他應用程序具有這些依賴關係。

"htmlparser": "1.7.6", "connect": "2.3.4", "connect_router": "1.8.6", "scoped-http-client": "0.9.7"

我部署了我的變化,但我仍然收到Cannot POST /hubot/say,當我嘗試打這條路線。

有什麼我失蹤?我對node.js或hubot不是很熟悉。

+0

你在添加文件夾? 'scripts'? – Outsider 2013-05-15 04:55:02

+1

日誌說什麼? – maletor 2013-06-19 21:14:56

+0

解決了?我試過你的腳本,它工作正常http:// localhost:8080/hubot/say?message = lala&room =#dev – 2014-03-07 01:13:48

回答

1

要加載在Hubot內置的腳本,你必須將其添加到hubot-scripts.json,如:

["http-post-say.coffee"] 

(由於腳本本身看起來很好,它聽起來就像你被推到Heroku的(重啓Hubot )這是我能想到的唯一的事情,這將解釋它不起作用。)

1

你必須明白,一旦你將你的代碼推到heroku上並使它在那裏運行,URL不再是localhost,而是實際的heroku與您創建機器時相關的URL heroku create

的URL看起來應該是這樣的:

curl -X POST `http://herokumachinename/hubot/say -d message=lala -d room='#dev'`