function HttpService(server) { this.getStudents = function() { return $.ajax({ url: server + '/students' }); } this.getStudentsById = function(studentId) { return $.ajax({ url: server + '/students/' + studentId, method: 'GET' }); } this.updateUserById = function(studentId, data) { return $.ajax({ url: server + '/students/' + studentId, method: 'PUT', data: data }); } this.createStudent = function(data) { return $.ajax({ url: server + '/students', method: 'POST', data: data }); } this.deleteStudent = function(studentId) { return $.ajax({ url: server + '/students/' + studentId, method: 'DELETE' }) } }