Created
January 31, 2021 14:03
-
-
Save lmas3009/61648aaff29bab49429e4e4e4d6c92a7 to your computer and use it in GitHub Desktop.
A Simple MERN Full Stack Application
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
app.get("/details", function (req, res) { | |
UserDetails.find((err, data) => { | |
if (err) { | |
res.status(501).send(err) | |
} | |
else { | |
res.status(200).send(data) | |
} | |
}) | |
}) | |
app.post("/details", function (req, res) { | |
const dbdata = req.body | |
UserDetails.create(dbdata, (err, data) => { | |
if (err) { | |
res.status(501).send(err) | |
} | |
else { | |
res.status(201).send(data) | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment