-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.ts
24 lines (20 loc) · 1.09 KB
/
router.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import * as express from 'express';
import { HomeController } from './controllers/home.controller';
import { UsersController } from './controllers/users.controller';
import { Authorizer } from './middlewares/authorizer';
export class Router {
router = express.Router();
homeController = new HomeController();
usersController = new UsersController();
authorizer = new Authorizer();
constructor() {
this.router.get('/', this.authorizer.authorize, this.homeController.index);
this.router.get('/users', this.authorizer.authorize, this.usersController.index);
this.router.get('/users/create', this.authorizer.authorize, this.usersController.create);
this.router.post('/users/update', this.authorizer.authorize, this.usersController.update);
this.router.get('/users/edit', this.authorizer.authorize, this.usersController.edit);
this.router.get('/users/delete', this.authorizer.authorize, this.usersController.delete);
this.router.get('/login', this.homeController.login);
this.router.post('/login', this.homeController.loginPost);
}
}