ga-dc / wdi5-project4

3 stars 0 forks source link

Pushing node app to Heroku #117

Closed lmdragun closed 9 years ago

lmdragun commented 9 years ago

I've looked at how others have done it and googled for more information. Heroku says that my app is running on traditional dynos and heroku status says there are no issues.

I get this every time I try to go to my app:

Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.

Here is my package.json:

{
  "name": "escapethecall",
  "version": "1.0.0",
  "description": "Escape the Call is a browser based choose your own adventure type game.",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "engines": {
    "node": "0.12.x",
    "npm": "2.7.x"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/lmdragun/escapethecall.git"
  },
  "keywords": [
    "game",
    "javascript",
    "node.js",
    "express.js",
    "jquery",
    "browser",
    "game"
  ],
  "author": "Lindsey Dragun",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/lmdragun/escapethecall/issues"
  },
  "homepage": "https://github.com/lmdragun/escapethecall",
  "dependencies": {
    "body-parser": "^1.12.4",
    "express": "^4.12.4",
    "hbs": "^3.0.1",
    "mongoose": "^4.0.4"
  }
}

Here is my Procfile:

web: node server.js 

I originally had index.js, but changed it to server.js because I didn't know if that was affecting things.

RobertAKARobin commented 9 years ago
var express = require("express");
var app = express();
var bodyParser = require("body-parser");

app.use( bodyParser.json() );
app.set('view engine', 'hbs')
app.use(express.static( __dirname + '/public'));

app.get("/", function( req, res ){
  res.render("index");
})

app.listen(process.env.PORT || 5000, function(){
  console.log("app listening on port 3000")
})
jrhorn424 commented 9 years ago

Also, in the future, if you're asked to check your logs, you can do that with heroku logs.