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{
|
try{
|
||||||
const {tags,title,contentItems} = req.body
|
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) {
|
} catch(e) {
|
||||||
const {tags,title,contentItems} = req.body
|
return res.status(500).json({
|
||||||
if(!tags || !title || !contentItems) {
|
errorMessage: (typeof e === 'string' ? e : e.message)
|
||||||
res.status(400).json({
|
|| 'Unknown error.'
|
||||||
errorMessage: 'missing params'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
res.status(500).json({
|
|
||||||
errorMessage: typeof e === 'string' ? e : e.message
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue