0.0.3 • Published 7 years ago

mongoose-express-crud v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

mongoose-crud

Enable all CRUD(Create, Read, Update, and Delete) endpoints with this express middleware.

Features

  • Creates endpoints for Get Post, Update, and Delete
  • Enables query strings for Get

Install

$ npm install mongoose-crud --save

API

import Crud from 'mongoose-crud';

new Crud(Mongoose Model);

const crud = new Crud(MongooseModel);

Example

import Crud from 'mongoose-express-crud';
import express from 'express';
import User from './models/User'; //Model for endpoints

const crud = new Crud(User);

const app = express();

app.use('/users', crud.routes)

app.listen(3000, () => {
  console.log('App listening on port 3000!')
});

note: If using require() you must add .default

var Crud = require('mongoose-crud').default