From a846d2a831a3486b5a37a82a1e47077510de5e5c Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 16 Nov 2019 19:24:43 -0500 Subject: [PATCH] add Route extender class --- src/class/Route.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/class/Route.ts diff --git a/src/class/Route.ts b/src/class/Route.ts new file mode 100644 index 0000000..2f33eec --- /dev/null +++ b/src/class/Route.ts @@ -0,0 +1,32 @@ +import { Router as router } from 'express'; +import { Server } from '../api'; + +export default class Route { + public server: Server; + + public router: router; + + public conf: { path: string, deprecated?: boolean }; + + constructor(server: Server, conf: { path: string, deprecated?: boolean }) { + this.server = server; + this.router = router(); + this.conf.path = conf.path; + if (conf.deprecated === undefined) this.conf.deprecated = false; + else this.conf.deprecated = conf.deprecated; + } + + get constants() { + return { + codes: { + SUCCESS: 100, + UNAUTHORIZED: 101, + NOT_FOUND: 104, + ACCOUNT_NOT_FOUND: 1041, + CLIENT_ERROR: 1044, + SERVER_ERROR: 105, + UNKNOWN_SERVER_ERROR: 1051, + }, + }; + } +}