@di-zed/yandex-smart-home
Version:
The Yandex Smart Home skills for the different device types.
60 lines (59 loc) • 1.61 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @author DiZed Team
* @copyright Copyright (c) DiZed Team (https://github.com/di-zed/)
*/
const express_1 = require("express");
const catchAsync_1 = __importDefault(require("../errors/catchAsync"));
const authController_1 = __importDefault(require("../controllers/authController"));
/**
* Auth Routes.
*/
class AuthRoutes {
/**
* Routes Constructor.
*/
constructor() {
/**
* Auth Controller.
*
* @protected
*/
this.controller = new authController_1.default();
/**
* Router.
*
* @protected
*/
this.router = (0, express_1.Router)();
this.initRoutes();
}
/**
* Routes Initialization.
*
* @returns void
* @protected
*/
initRoutes() {
// API Authorization Endpoint.
this.router
.route('/login')
.get((0, catchAsync_1.default)(this.controller.login.bind(this.controller)))
.post((0, catchAsync_1.default)(this.controller.loginPost.bind(this.controller)));
// Token Endpoint.
this.router.route('/token').post((0, catchAsync_1.default)(this.controller.token.bind(this.controller)));
}
/**
* Get Router.
*
* @returns Router
*/
getRouter() {
return this.router;
}
}
exports.default = new AuthRoutes().getRouter();