I have spent more than a hour on that.
What is wrong with this code?!
StudentController.js:
function StudentController() {
this.studentService = {};
};
StudentController.prototype.findAll = function(req, res){
this.studentService.something();
};
module.exports = StudentController;
app.js
var StudentController = require('./application/StudentController');
var studentController = new StudentController();
app.get('/students', studentController.findAll);
I am getting:
TypeError: Cannot call method 'something' of undefined
Why is "studentService" undefined ??
Thanks a lot!