Skip to content

Middleware to check if account is active/verified/blocked etc. #138

@gtd57

Description

@gtd57

Hi There,
Is there any way to put a middleware in restify object of routes.js file to check whether the User is Verified/Active, up on middleware fail api calls might return 400 bad request saying "Account need to be Verified/Active to do this action".

My wired thought is like, passing the list of middlewares before routing.
Example.
restify.user ('/api/test/user', [LIST_OF_MIDDLEWARES], c.api.test, ['list', 'get']);

The reason behind this is, I need to get the support of Restify.prototype._sendError for output json object.
If I am thinking wrong, can you please tell me the appropriate way of doing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions