rest api node mongo code example
Example: 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);}