function HttpService(apiUrl) { this.getAllStudents = function() { return $.ajax({ url: `${apiUrl}/students`, method: 'GET' }); // $.get(`${api}/students`); }; this.getStudentById = function(id) { return $.ajax({ url: `${apiUrl}/students/${id}`, method: 'GET' }); }; this.updateStudentsById = function(id, data) { return $.ajax({ url: `${apiUrl}/students/${id}`, method: 'PUT', data: data }); }; this.deleteStudentById = function(id) { return $.ajax({ url: `${apiUrl}/students/${id}`, method: 'DELETE' }); }; this.postStudentsById = function(data) { return $.ajax({ url: `${apiUrl}/students`, method: 'POST', data: data }); }; }