expressing-mongoose
v1.0.2
Published
mongoose router to express js
Downloads
5
Readme
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