-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
30 lines (23 loc) · 1.16 KB
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const fs = require('fs');
const path = require('path');
const SessionController = require('./controllers/session_controller');
const PatientController = require('./controllers/patient_controller');
const DoctorController = require('./controllers/doctor_controller');
module.exports = function (app){
app.route('/api/login')
.post((req, res) => SessionController.create(req, res))
.delete((req, res) => SessionController.destroy(req, res));
app.route('/api/login/current')
.get((req, res) => SessionController.fetchCurrent(req, res));
app.route('/api/patients')
.get((req, res) => PatientController.all(req, res));
app.route('/api/patients/file')
.post((req, res) => PatientController.createFile(req, res))
.delete((req, res) => PatientController.destroyFile(req, res));
app.route('/api/patients/appointment')
.post((req, res) => PatientController.createAppointment(req, res))
.patch((req, res) => PatientController.updateAppointment(req, res))
.delete((req, res) => PatientController.destroyAppointment(req, res));
app.route('/api/doctors')
.get((req, res) => DoctorController.all(req, res));
};