I am trying to deploy my angular app to heroku. It runs fine locally.
Directory:
nice-notes
controllers
api.js
index.js
Model
model.js
public
main.js
main.css
views
index.jade
layout.jade
payment.jade
app.js
package.json
Procfile
node_modules
My app.js looks like so:
app.set('view engine', 'jade');
app.set('views', __dirname + '/views');
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({extended: false}));
app.get('/', indexController.index);
app.get('/payment', indexController.payment);
app.get('/api/notes', apiController.get);
app.post('/api/notes', apiController.noteUpdate);
My controller:
var Note = require('../Model/model')
var indexController = {
index: function(req, res) {
res.render('index');
},
payment: function(req, res) {
res.render('payment');
}
}
module.exports = indexController;
I have tried using this instead, but 'path' is not defined.
app.set('views', path.join(__dirname, 'views'));
All my base code is identical to my other angular apps, apart from the fact that I'm not injecting any templates here (using ng-view).
I have tried changing the file paths and other potential solutions to no avail.