({ listComments })
| 1 | export default function makeGetComments ({ listComments }) { |
| 2 | return async function getComments (httpRequest) { |
| 3 | const headers = { |
| 4 | 'Content-Type': 'application/json' |
| 5 | } |
| 6 | try { |
| 7 | const postComments = await listComments({ |
| 8 | postId: httpRequest.query.postId |
| 9 | }) |
| 10 | return { |
| 11 | headers, |
| 12 | statusCode: 200, |
| 13 | body: postComments |
| 14 | } |
| 15 | } catch (e) { |
| 16 | // TODO: Error logging |
| 17 | console.log(e) |
| 18 | return { |
| 19 | headers, |
| 20 | statusCode: 400, |
| 21 | body: { |
| 22 | error: e.message |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |
no outgoing calls
no test coverage detected