Skip to content

jellehak/express-mongoose-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Creates default REST routes:
GET, POST

:id
GET, PUT, DELETE

Install

npm install https://github.com/jellehak/express-mongoose-rest.git

Usage

Simple:

const RESTFactory = require("express-mongoose-rest")
router.use("/api/test",RESTFactory("test"))

Advanced:

const RESTFactory = require("express-mongoose-rest")
const defaultForce = {
    //creator: 'req.user._id',
    company: 'req.user.companyId'
}
const defaultQuery = '{ company: req.user.companyId}'

router.use("/api/test",
    RESTFactory("test", { hide: ['description'],populate:["owners"], query: defaultQuery, force: defaultForce}))

About

Rest factory for Express and mongoose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published