import { Request, Response } from 'express'; import { KnexCrudOptions } from './KnexCrudOptions'; import { CrudHandler } from './CrudHandler'; export class KnexCrudHandler implements CrudHandler { protected table: string; protected columns: Array; protected options: KnexCrudOptions; public constructor ( table: string, columns: Array, options: KnexCrudOptions = {} ) { this.table = table; this.columns = columns; this.options = options; } private call_auth (auth?: Function, req: Request, res: Response): boolean { if (typeof auth === 'undefined') return true; const promise = new Promise ((resolve) => { const result = auth (req, res, resolve); }); } public async create (req: Request, res: Response): Promise { if (typeof req.body === 'undefined') throw new Error ('request body is undefined. is body-parser running?'); const data = JSON.parse (req.body); } public async read (req: Request, res: Response): Promise { } public async update (req: Request, res: Response): Promise { } public async delete (req: Request, res: Response): Promise { } }