post api call using node js and mongo code example
Example 1: rest api with mongodb and nodejs
npm install express --save
Example 2: fetch api based on id nodejs and mongodb
// contactModel.jsvar mongoose = require('mongoose');// Setup schemavar contactSchema = mongoose.Schema({ name: { type: String, required: true }, email: { type: String, required: true }, gender: String, phone: String, create_date: { type: Date, default: Date.now }});// Export Contact modelvar Contact = module.exports = mongoose.model('contact', contactSchema);module.exports.get = function (callback, limit) { Contact.find(callback).limit(limit);}