Skip to content

Instantly share code, notes, and snippets.

@seanpmaxwell
Last active January 24, 2019 15:33
Show Gist options
  • Save seanpmaxwell/729ff9a4a437c0a2cada2beee736b612 to your computer and use it in GitHub Desktop.
Save seanpmaxwell/729ff9a4a437c0a2cada2beee736b612 to your computer and use it in GitHub Desktop.
export class UserController {
getRoutes(): Router {
let router = express.Router();
router.get('/api/users/:id', [middleware1, middleware2], (req, res, next) => {
this.get(req, res, next);
}
return router;
}
get(req: Request, res: Response, next: NextFunction): any {
console.log(req.params.id);
return res.status(200).json({msg: 'get_called'});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment