refactor testing
parent
fcf4f092e8
commit
48ecf478f7
|
@ -9,7 +9,8 @@ app.use(express.json());
|
|||
|
||||
app.get("/api/getRequests", async (request, response) => {
|
||||
var requestCount = ( request.query.count ? parseInt(request.query.count as string, 10) : 5 );
|
||||
requests.getRequests(requestCount,response);
|
||||
requests.getRequests(requestCount).then((val: any) => console.log(val));
|
||||
response.send(requests.getRequests(requestCount));
|
||||
});
|
||||
|
||||
app.get("/api/getAllRequests", async (request, response) => {
|
||||
|
|
|
@ -8,10 +8,10 @@ const getRequestsQuery = {
|
|||
text: "SELECT * FROM requests_vw LIMIT $1"
|
||||
}
|
||||
|
||||
export async function getRequests(count: number, response: express.Response) {
|
||||
export async function getRequests(count: number) {
|
||||
var query = Object.assign(getRequestsQuery, { values: [count] });
|
||||
db.query(query)
|
||||
.then((result: pg.QueryResult) => response.send(result.rows))
|
||||
.then((result: pg.QueryResult) => result.rows)
|
||||
.catch((e: any) => console.error(e.stack));
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue