mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
21 lines
508 B
JavaScript
Executable File
21 lines
508 B
JavaScript
Executable File
import { GetPostData } from "../services"
|
|
|
|
export default {
|
|
method: "GET",
|
|
route: "/post/:post_id",
|
|
middlewares: ["withOptionalAuthentication"],
|
|
fn: async (req, res) => {
|
|
let post = await GetPostData({
|
|
post_id: req.params.post_id,
|
|
for_user_id: req.user?._id.toString(),
|
|
}).catch((error) => {
|
|
res.status(404).json({ error: error.message })
|
|
|
|
return null
|
|
})
|
|
|
|
if (!post) return
|
|
|
|
return res.json(post)
|
|
}
|
|
} |