1
0
Fork 0

add Route extender class

refactor/models
Matthew 2019-11-16 19:24:43 -05:00
parent e42761dcda
commit a846d2a831
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 32 additions and 0 deletions

32
src/class/Route.ts Normal file
View File

@ -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,
},
};
}
}