Reputation: 1630
I'm trying to deploy a basic nodejs app to OpenShift. I'm not sure how to do it with webpack though. Do I build the bundle.js file locally and just deploy that along with the index.html? I tried that by putting the bundle.js file in a /public directory and pointing to that using a relative path in the index.html, but I get bundle.js not found error. (It works when I run it locally.) What step am I missing? Must I not use relative paths in OpenShift? I find the documentation for OpenShift rather complicated. If anybody out there can break this down I'd much appreciate it!
Upvotes: 0
Views: 933
Reputation: 1630
I did miss a step: You need to add the directory in the server.js like so:
self.initializeServer = function() {
self.createRoutes();
self.app = express.createServer();
self.app.configure(function() {
self.app.use('/public', express.static(__dirname+'/public'));
});
// Add handlers for the app (from the routes).
for (var r in self.routes) {
self.app.get(r, self.routes[r]);
}
};
Upvotes: 3