Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support routes with existing baseUrl #1

Closed
asherholder opened this issue Oct 22, 2017 · 1 comment
Closed

Support routes with existing baseUrl #1

asherholder opened this issue Oct 22, 2017 · 1 comment

Comments

@asherholder
Copy link

appending the req.baseUrl to the req.route.path should do the job

function validate(req, res, next) {
    let fullRoutePath = req.baseUrl ? req.baseUrl + req.route.path : req.route.path;
    return Promise.all([
        _validateParams(req.headers, req.params, req.query, fullRoutePath, req.method.toLowerCase()),
        _validateBody(req.body, fullRoutePath, req.method.toLowerCase())
    ]).then(function () {
        return next();
    }).catch(function (error) {
        return next(new InputValidationError(error));
    });
};
@idanto idanto closed this as completed in #2 Oct 23, 2017
idanto added a commit that referenced this issue Oct 23, 2017
- Add option to beautify errors
- Add option to get only the first error
- Resolve #1
- Change tests to work with supertest to get more stability and consistency
@idanto
Copy link
Contributor

idanto commented Oct 23, 2017

released in version v0.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants