Skip to content

Commit

Permalink
change routes
Browse files Browse the repository at this point in the history
  • Loading branch information
yingqi-chen committed Jun 22, 2020
1 parent 294d604 commit 4cdcd59
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions controllers/appointmentsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Appoinment = require('../models/appointments');
const Mongoose = require('mongoose');
const appointments = require('../models/appointments');


const getAppointment = async (req, res) =>{
try{
result = await Appoinment.find({_id: req.params.appointmentId})
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"bcrypt": "^5.0.0",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"express-list-endpoints": "^4.0.1",
"express-validator": "^6.5.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.9.19",
Expand Down
12 changes: 9 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
const express = require('express');
const app = express();
var mongoose = require('mongoose');
const authRoutes = require('./routes/authRoutes');
const doctorRoutes = require('./routes/doctorRoutes');
const patientRoutes = require('./routes/patientRoutes')
const {loginRequired} = require('./controllers/authController')
const bodyParser = require('body-parser')
const listEndpoints = require('express-list-endpoints');
const {login, register} = require('./controllers/authController');





//Set up default mongoose connection
Expand Down Expand Up @@ -38,12 +42,14 @@ app.use(async (req, res, next) => {
});

//login route
app.post('/auth', authRoutes)
app.post('/auth/login', login);
app.post('/auth/register', register);
app.use('/doctors', loginRequired, doctorRoutes)
app.use('/patients', loginRequired, patientRoutes)

const PORT = 3000;

app.listen(PORT, () => {
console.log(`listening on port ${PORT}`)
console.log(`listening on port ${PORT}`);
console.log(listEndpoints(app));
})

0 comments on commit 4cdcd59

Please sign in to comment.