1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-26 15:29:22 +00:00
comunicapiv2/src/controllers/Routes.ts
2019-11-23 14:03:14 +01:00

37 lines
1.0 KiB
TypeScript

import { WelcomeController } from "./WelcomeController";
import { RequestHandler } from "../entities/RequestHandler";
import { AccountController } from "./AccountController";
/**
* Controllers routes
*
* @author Pierre Hubert
*/
export enum RouteType {
POST, // Default
GET
}
export interface Route {
type ?: RouteType,
path: string,
cb: (req : RequestHandler) => Promise<void> | void,
needLogin ?: boolean, // Default = true
}
export const Routes : Route[] = [
// Welcome controller
{type: RouteType.GET, path: "/", cb: WelcomeController.HomeMessage, needLogin: false},
// Account controller
{path: "/account/login", cb: AccountController.LoginUser, needLogin: false},
{path: "/user/connectUSER", cb: AccountController.LoginUser, needLogin: false}, // Legacy
{path: "/account/logout", cb: AccountController.LogoutUser},
{path: "/user/disconnectUSER", cb: AccountController.LogoutUser}, // Legacy
{path: "/account/id", cb: AccountController.CurrentUserID},
{path: "/user/getCurrentUserID", cb: AccountController.CurrentUserID}, // Legacy
]