2019-11-21 17:06:50 +00:00
|
|
|
import { WelcomeController } from "./WelcomeController";
|
2019-11-22 07:50:15 +00:00
|
|
|
import { RequestHandler } from "../entities/RequestHandler";
|
|
|
|
import { AccountController } from "./AccountController";
|
2019-11-23 14:11:33 +00:00
|
|
|
import { UserController } from "./UserController";
|
2019-11-21 17:06:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Controllers routes
|
|
|
|
*
|
|
|
|
* @author Pierre Hubert
|
|
|
|
*/
|
|
|
|
|
|
|
|
export enum RouteType {
|
|
|
|
POST, // Default
|
|
|
|
GET
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Route {
|
|
|
|
type ?: RouteType,
|
|
|
|
path: string,
|
2019-11-23 12:24:24 +00:00
|
|
|
cb: (req : RequestHandler) => Promise<void> | void,
|
2019-11-23 12:47:06 +00:00
|
|
|
needLogin ?: boolean, // Default = true
|
2019-11-21 17:06:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Routes : Route[] = [
|
|
|
|
|
|
|
|
// Welcome controller
|
2019-11-23 12:47:06 +00:00
|
|
|
{type: RouteType.GET, path: "/", cb: WelcomeController.HomeMessage, needLogin: false},
|
2019-11-21 17:06:50 +00:00
|
|
|
|
2019-11-22 07:50:15 +00:00
|
|
|
// Account controller
|
2019-11-23 12:47:06 +00:00
|
|
|
{path: "/account/login", cb: AccountController.LoginUser, needLogin: false},
|
|
|
|
{path: "/user/connectUSER", cb: AccountController.LoginUser, needLogin: false}, // Legacy
|
2019-11-23 13:03:14 +00:00
|
|
|
|
|
|
|
{path: "/account/logout", cb: AccountController.LogoutUser},
|
|
|
|
{path: "/user/disconnectUSER", cb: AccountController.LogoutUser}, // Legacy
|
2019-11-23 12:48:16 +00:00
|
|
|
|
|
|
|
{path: "/account/id", cb: AccountController.CurrentUserID},
|
|
|
|
{path: "/user/getCurrentUserID", cb: AccountController.CurrentUserID}, // Legacy
|
2019-11-23 14:11:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
// User controller
|
|
|
|
{path: "/user/getInfo", cb: UserController.GetSingle, needLogin: false},
|
|
|
|
{path: "/user/getInfos", cb: UserController.GetSingle, needLogin: false}, // Legacy
|
|
|
|
|
|
|
|
{path: "/user/getInfoMultiple", cb: UserController.GetMultiple, needLogin: false},
|
|
|
|
{path: "/user/getInfosMultiple", cb: UserController.GetMultiple, needLogin: false}, // Legacy
|
2019-11-21 17:06:50 +00:00
|
|
|
]
|