12 lines
608 B
JavaScript
12 lines
608 B
JavaScript
|
import { Router } from 'express';
|
||
|
import auth from '../middlewares/auth.js';
|
||
|
import GroupController from '../controllers/group.js'
|
||
|
import existance from '../middlewares/existance.js';
|
||
|
|
||
|
const GroupRouter = new Router();
|
||
|
|
||
|
GroupRouter.post('/create/:name', auth.authenticate, existance.groupDoesntExist, GroupController.create);
|
||
|
GroupRouter.post('/join/:id', auth.authenticate, existance.groupExists, auth.checkGroupPassword, GroupController.join);
|
||
|
GroupRouter.post('/password/:id', auth.authenticate, existance.groupExists, auth.authorizeGroupOwner, GroupController.updatePassword)
|
||
|
|
||
|
export default GroupRouter;
|