jspears / mers

Mongoose Express Rest Service
MIT License
342 stars 42 forks source link

Put / create #12

Closed mlconnor closed 11 years ago

mlconnor commented 11 years ago

Hey man, I love the project, thanks for the hard work. Qq. I checked the docs and examples but didn't see how to create objects. Is it assumed that I would roll my own for object creation?

jspears commented 11 years ago

Create is done via post. The tests have some examples. Maybe I missunderstand the issue, let me know.

mlconnor commented 11 years ago

I should have checked the tests. I went for the examples. I found the answer in routes.js. Makes perfect sense.

router.post(base + '/:type', function (req, res, next) {
    var Model = m(req);
    new Model(clean(req.body)).save(run(res));
});