Created
May 25, 2013 21:40
-
-
Save anonymous/5650879 to your computer and use it in GitHub Desktop.
Routing/path problem deploying to nodejitsu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('coffee-script') | |
server = require("./server"); | |
config = require("./config"); | |
server.startServer(config, function(){}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var config = { | |
"watch": { | |
"sourceDir": [ | |
"assets" | |
], | |
"compiledDir": [ | |
"public" | |
], | |
"javascriptDir": [ | |
"javascripts" | |
], | |
"exclude": [], | |
"throttle": 0, | |
"excludeRegex": {}, | |
"compiledJavascriptDir": [ | |
"public", | |
"javascripts" | |
] | |
}, | |
"liveReload": { | |
"enabled": false | |
}, | |
"server": { | |
"defaultServer": { | |
"enabled": false, | |
"onePager": false | |
}, | |
"path": [ | |
"server.coffee" | |
], | |
"port": 80, | |
"base": "", | |
"views": { | |
"compileWith": "jade", | |
"extension": "jade", | |
"path": [ | |
"views" | |
] | |
} | |
} | |
} | |
var resolvePath = function (pathPieces) { | |
var returnPath = __dirname; | |
pathPieces.forEach(function(piece) { | |
returnPath = path.join(returnPath, piece); | |
}) | |
return returnPath; | |
} | |
if (config.watch) { | |
config.watch.compiledDir = resolvePath(config.watch.compiledDir); | |
config.watch.sourceDir = resolvePath(config.watch.sourceDir); | |
config.watch.javascriptDir = resolvePath(config.watch.javascriptDir) | |
config.watch.compiledJavascriptDir = resolvePath(config.watch.compiledJavascriptDir); | |
} | |
if (config.server) { | |
if (config.server.path) { | |
config.server.path = resolvePath(config.server.path); | |
} | |
if (config.server.views && config.server.views.path) { | |
config.server.views.path = resolvePath(config.server.views.path); | |
} | |
} | |
module.exports = config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "euchre", | |
"version": "0.0.1-38", | |
"homepage": "", | |
"author": "[email protected]", | |
"description": "", | |
"contributors": [ | |
{ | |
"name": "", | |
"email": "" | |
} | |
], | |
"private": true, | |
"dependencies": { | |
"express": "3.1.0", | |
"coffee-script": "1.6.2", | |
"consolidate": "0.8.0", | |
"jade": "0.28.2" | |
}, | |
"subdomain": "euchre", | |
"scripts": { | |
"start": "app.js" | |
}, | |
"engines": { | |
"node": "0.8.x" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.jade renders | |
Included assets fail | |
GET http://euchre.nodejitsu.com/javascripts/vendor/require.js 404 (Not Found) euchre.nodejitsu.com:1 | |
GET http://euchre.nodejitsu.com/stylesheets/style.css 404 (Not Found) euchre.nodejitsu.com:1 | |
folder structure: | |
public | |
javascripts | |
app | |
vendor | |
require.js | |
jade-runtime.js | |
jquery.js | |
main.js | |
template.js | |
stylesheets | |
style.css | |
routes | |
index.coffee | |
views | |
index.jade | |
layout.jade | |
package.json | |
server.coffee |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
express = require 'express' | |
engines = require 'consolidate' | |
path = require 'path' | |
exports.startServer = (config, callback) -> | |
app = express() | |
server = app.listen config.server.port, -> | |
console.log "Express server listening on port %d in %s mode", server.address().port, app.settings.env | |
app.configure -> | |
app.set 'port', config.server.port | |
app.set 'views', config.server.views.path | |
app.engine config.server.views.extension, engines[config.server.views.compileWith] | |
app.set 'view engine', config.server.views.extension | |
app.use express.favicon() | |
app.use express.bodyParser() | |
app.use express.methodOverride() | |
app.use express.compress() | |
#original line, value = /opt/haibu/apps/jimmack1963/euchre/package/public | |
app.use express.static(config.watch.compiledDir) | |
#console.log '2 param' | |
app.use '/public', express.static(config.watch.compiledDir) | |
#path.join(config.watch.compiledDir, 'stylesheets') | |
#more verbose? | |
app.use '/stylesheets', express.static( path.join(config.watch.compiledDir, 'stylesheets')) | |
app.use '/public/stylesheets', express.static(path.join(config.watch.compiledDir, 'stylesheets')) | |
app.use config.server.base, app.router | |
app.configure 'development', -> | |
app.use express.errorHandler() | |
routes = require './routes' | |
app.get '/', routes.index(config) | |
callback(server) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment