mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
21 lines
466 B
JavaScript
Executable File
21 lines
466 B
JavaScript
Executable File
import getComments from "../services/getComments"
|
|
|
|
export default {
|
|
method: "GET",
|
|
route: "/post/:post_id",
|
|
fn: async (req, res) => {
|
|
const { post_id } = req.params
|
|
|
|
const comments = await getComments({ parent_id: post_id }).catch((err) => {
|
|
res.status(400).json({
|
|
error: err.message,
|
|
})
|
|
|
|
return false
|
|
})
|
|
|
|
if (!comments) return
|
|
|
|
return res.json(comments)
|
|
}
|
|
} |