Created
January 29, 2021 15:25
-
-
Save lmas3009/65d9589ae11b7e34b50b977249d2d47d to your computer and use it in GitHub Desktop.
Rest API using MEN (MongoDB,ExpressJs and NodeJs)
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("/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