Last active
November 13, 2018 21:00
-
-
Save abhiaiyer91/ab28e0973a3f0fbb84fc440f4ca6b901 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** rest of code above **/ | |
server.post("/post/publish/:id", async (req, res) => { | |
const postId = req.params.id; | |
// Use the updatePost API from prisma client | |
try { | |
const publishedPost = await prisma.updatePost({ | |
where: { | |
id: postId | |
}, | |
data: { | |
published: true | |
} | |
}); | |
return res.send(publishedPost).status(200); | |
} catch (e) { | |
console.error(e); | |
return res.sendStatus(500); | |
} | |
}); | |
/** rest of code below **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment