Skip to content

Instantly share code, notes, and snippets.

@abhiaiyer91
Created November 13, 2018 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhiaiyer91/e5baa6c094cfb2214d2874b7e157d561 to your computer and use it in GitHub Desktop.
Save abhiaiyer91/e5baa6c094cfb2214d2874b7e157d561 to your computer and use it in GitHub Desktop.
/** rest of code above **/
server.get("/user/:id", async (req, res) => {
const userId = req.params.id;
// Use the user API from prisma client
try {
const user = await prisma.user({
id: userId
});
return res.send(user).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