express-crud-router icon indicating copy to clipboard operation
express-crud-router copied to clipboard

Option to let express-sequelize-crud act as middleware?

Open Bossieh opened this issue 4 years ago • 2 comments

First of all thanks for a lot for express-sequelize-crud <3

And I am wondering if it's possible to let express-sequelize-crud act as middleware?

So instead of:

async (req, res, next) => {
    ...
    res.json(rows);
}

I would like it to do something like this:

async (req, res, next) => {
    ...
    res.bodyInterface.setData(rows);
    next();
}

So I can do other stuff like logging after express-sequelize-crud did his thing.

Bossieh avatar May 14 '21 11:05 Bossieh

Sorry for the delay to answer... we are not used to maintain open source packages and definitely have an improvement area in how we answer to our users.

I am not aware of how to correctly deal with the use case you describe. I can't find any information about res.bodyInterface. Could you point to some documentation explaining how to deal with this?

Thanks

nicgirault avatar Dec 06 '21 19:12 nicgirault

@nicgirault Thanks for the reply, res.bodyInterface is just a tiny interface I added myself in a middleware function.

Bossieh avatar Dec 09 '21 14:12 Bossieh

As there is no activity on this pull request and I am not sure how to handle this correctly, I am closing this issue for now.

nicgirault avatar Aug 19 '23 13:08 nicgirault