1.0.2 • Published 6 years ago

expressing-mongoose v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

expressing-mongoose

mongoose router to express js

Install

npm  install --save expressing-mongoose

Usage

const mongooseRouter = require('mongoose-express-router')
mongoose.Promise = Promise
mongoose.connect('mongodb://localhost/myapp')
const schema = mongoose.Schema({
    user: String
},{strict: true})
mongoose.model('user', schema)
const router = mongooseRouter(mongoose)
const app = express()
app.use(bodyParser.json())
app.use('/path/to/expose/mongoose',router)
app.listen() // app is listen in '/path/to/expose/mongoose'/:model/:id
// GET -> findResult
// POST -> createResult
// PUT -> updateResult
// DELETE -> deleteResult