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

Function makeDeleteComment

src/controllers/delete-comment.js:1–25  ·  view source on GitHub ↗
({ removeComment })

Source from the content-addressed store, hash-verified

1export default function makeDeleteComment ({ removeComment }) {
2 return async function deleteComment (httpRequest) {
3 const headers = {
4 'Content-Type': 'application/json'
5 }
6 try {
7 const deleted = await removeComment({ id: httpRequest.params.id })
8 return {
9 headers,
10 statusCode: deleted.deletedCount === 0 ? 404 : 200,
11 body: { deleted }
12 }
13 } catch (e) {
14 // TODO: Error logging
15 console.log(e)
16 return {
17 headers,
18 statusCode: 400,
19 body: {
20 error: e.message
21 }
22 }
23 }
24 }
25}

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected