Skip to content

Instantly share code, notes, and snippets.

@lmas3009
Created January 29, 2021 15:25
Show Gist options
  • Save lmas3009/65d9589ae11b7e34b50b977249d2d47d to your computer and use it in GitHub Desktop.
Save lmas3009/65d9589ae11b7e34b50b977249d2d47d to your computer and use it in GitHub Desktop.
Rest API using MEN (MongoDB,ExpressJs and NodeJs)
app.get("/Cars", function (req, res) {
try {
Cars.find((err, data) => {
if (err) {
res.status(500).send(err)
}
else {
res.status(200).send(data)
}
})
} catch (error) {
console.log(error);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment