Last active
July 19, 2020 06:24
-
-
Save Sarav-S/432b36ffe19092639396d9986f80ba7c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const ProfileRequest = require('./app/Requests/ProfileRequest'); | |
app.post("/profile/:id", ProfileRequest, (request, response) => { | |
const user = await User.findById(request.params.id); | |
if (!user) return response.status(404).send({ message: "User not found" }); | |
user.name = request.body.name; | |
user.email = request.body.email; | |
await user.save(); | |
return response.send({ | |
message: "Profile updated successfully" | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment