Skip to content

Instantly share code, notes, and snippets.

@lmas3009
Created January 31, 2021 14:03
Show Gist options
  • Save lmas3009/61648aaff29bab49429e4e4e4d6c92a7 to your computer and use it in GitHub Desktop.
Save lmas3009/61648aaff29bab49429e4e4e4d6c92a7 to your computer and use it in GitHub Desktop.
A Simple MERN Full Stack Application
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