posts post endpoint
This commit is contained in:
parent
ea77a4dd7e
commit
230228713d
1 changed files with 9 additions and 10 deletions
|
|
@ -1757,19 +1757,18 @@ module.exports = async (
|
|||
}
|
||||
})
|
||||
|
||||
app.post(`/api/gun/wall`, async (req,res) => {
|
||||
app.post(`/api/gun/wall/`, async (req,res) => {
|
||||
try{
|
||||
const {tags,title,contentItems} = req.body
|
||||
res.status(201).json(await GunActions.createPost(title,tags,contentItems))
|
||||
return res.status(201).json(await GunActions.createPost(
|
||||
tags,
|
||||
title,
|
||||
contentItems
|
||||
))
|
||||
} catch(e) {
|
||||
const {tags,title,contentItems} = req.body
|
||||
if(!tags || !title || !contentItems) {
|
||||
res.status(400).json({
|
||||
errorMessage: 'missing params'
|
||||
})
|
||||
}
|
||||
res.status(500).json({
|
||||
errorMessage: typeof e === 'string' ? e : e.message
|
||||
return res.status(500).json({
|
||||
errorMessage: (typeof e === 'string' ? e : e.message)
|
||||
|| 'Unknown error.'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue