fixes
This commit is contained in:
parent
7a9e12e62d
commit
999d493c68
@ -1,5 +1,5 @@
|
||||
export default class Session {
|
||||
public user_id: number;
|
||||
public user_name: string;
|
||||
public permissions: Array<string>;
|
||||
public user_id?: number;
|
||||
public user_name?: string;
|
||||
public permissions?: Array<string>;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export default class Status {
|
||||
return this._status;
|
||||
}
|
||||
|
||||
public set status (value: number): void {
|
||||
public set status (value: number) {
|
||||
this._status = value;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Request, Response } from '@types/express';
|
||||
import { Request, Response } from 'express';
|
||||
import Status from './Status';
|
||||
import Session from './Session';
|
||||
|
||||
@ -12,7 +12,7 @@ export default class Transaction {
|
||||
public get req (): Request { return this._req; }
|
||||
public get res (): Response { return this._res; }
|
||||
public get status (): Status { return this._status; }
|
||||
public session: Session;
|
||||
public session?: Session;
|
||||
|
||||
/* constructor */
|
||||
public constructor (req: Request, res: Response) {
|
||||
@ -22,8 +22,8 @@ export default class Transaction {
|
||||
}
|
||||
|
||||
/* methods */
|
||||
public finalize (): void {
|
||||
if (this._status.has_status ())
|
||||
public finalize (data: any): void {
|
||||
if (this._status.has_status)
|
||||
this._res.status (this.status.status);
|
||||
this._res.end (data);
|
||||
}
|
||||
|
12
lib/index.ts
12
lib/index.ts
@ -1,4 +1,4 @@
|
||||
import { App } from '@types/express';
|
||||
import { App } from 'express';
|
||||
import Handler from './classes/Handler';
|
||||
|
||||
/**
|
||||
@ -9,13 +9,13 @@ import Handler from './classes/Handler';
|
||||
*/
|
||||
export default function load_handlers (
|
||||
app: App,
|
||||
handlers: array<Handler>
|
||||
handlers: Array<Handler>
|
||||
): void {
|
||||
for (const h of handlers)
|
||||
app.use (h.path, h.run_http_handler);
|
||||
}
|
||||
|
||||
export * from './classes/Session.ts';
|
||||
export * from './classes/Status.ts';
|
||||
export * from './classes/Transaction.ts';
|
||||
export * from './classes/Handler.ts';
|
||||
export * from './classes/Session';
|
||||
export * from './classes/Status';
|
||||
export * from './classes/Transaction';
|
||||
export * from './classes/Handler';
|
||||
|
Reference in New Issue
Block a user