This repository has been archived on 2020-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
requestor/lib/transaction.ts

29 lines
596 B
TypeScript

import consts from '@scode/consts';
import {Request,Response} from 'express';
class Transaction {
/* private */
private _req: Request;
private _res: Response;
/* public */
public status: number = -1;
/* properties */
public get has_status(): boolean => this.status !== -1;
public get req(): Request => this._req;
public get res(): Response => this._res;
/* constructor */
public Request(req: Request,res: Response) {
this._req = req;
this._res = res;
}
/* methods */
public end() {
if (this.status !== -1)
this.res.setHeader(this.status);
}
}