Created
January 29, 2021 15:25
-
-
Save lmas3009/946c97c3792fa39a35ece41d4597e750 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.post("/Cars_add", function (req, res) { | |
const dbfeed = req.body | |
try { | |
Cars.create(dbfeed, (err, data) => { | |
if (err) { | |
res.status(500).send(err) | |
} | |
else { | |
res.status(201).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