0
我對Heroku來說很新穎,並且在簡單的節點應用程序啓動和訪問時遇到了一些麻煩。Node.js在本地加載,但不在heroku上
我可以在本地運行該應用程序,但一旦它被推送到Heroku,我會得到應用程序錯誤。
我已經在我的package.json中添加了一個Procfile以及一個'start'值,但無論如何,我始終得到「應用程序錯誤」。
我知道類似的問題已經被問到,但那裏的解決方案還沒有解決問題。
的package.json:
{
"name": "twiliosender",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"author": "",
"license": "ISC",
"engines": {
"node": "4.4.7"
},
"dependencies": {
"cool-ascii-faces": "^1.3.4",
"express": "^4.14.0",
"node": "0.0.0",
"twilio": "^2.10.0"
}
}
Procfile:
web: node index.js
index.js
var client = require('twilio')(accountSid, authToken);
var express = require('express');
var app = express();
app.get('/', function(req, res){
res.sendFile('/static/index.html',{root: __dirname})
});
app.post('/send',
function(req, res){
res.send(client.messages.create({
to: ""
, from: ""
, body: possibleTextMessages[picker()],
}, function(err, message) {
console.log(message.sid);
})
)});
app.listen(3000)