jspears / mers

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

How do you use transformers ? #46

Closed windmaomao closed 9 years ago

windmaomao commented 9 years ago

I tried

app.use('/api/v1', mers({uri:'mongodb://localhost/database'}).rest({
    mongoose:mongoose,
    transformers: {
        renameid: function (obj) {
            obj.id = obj._id;
            delete obj._id;
            return obj;
        }
    }
}));

but i always getting the error "could not find transformer for renameid", how do I register a transformer ?

Fang

jspears commented 9 years ago

That's correct, there is a bug. Fixed in the develop branch. I'll publish a new module tonight with any luck.