MCPcopy Index your code
hub / github.com/dev-mastery/comments-api / makeGetComments

Function makeGetComments

src/controllers/get-comments.js:1–27  ·  view source on GitHub ↗
({ listComments })

Source from the content-addressed store, hash-verified

1export 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}

Callers 2

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected