I have a simple script called countries.js under routes folder in my application. It fails to start because this line in index.js
var countries = require('./countries');
locally everything works ok. how do I load my own scripts in openshift? files structure :
-app-directory
|
\ public
|
\ views
|
\ routes
|
\ index.js
|
\ countries.js
|
\ package.json
|
\ server.js
any ideas?
I can't say I've ever used openshift. You might try adding the .js
extension in your require statement. If that doesn't work and I was faced with your dilemma I would try the following, which should work on any platform, albeit it is a bit explicit.
var path = require('path'),
countries = require(path.resolve(path.join('.','countries.js')));
If that still doesn't work I'd suggest you start asking your hosting provider questions.