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

Custom blueprint route masked by findOne route #4457

Open
danielsharvey opened this issue Jun 19, 2018 · 2 comments
Open

Custom blueprint route masked by findOne route #4457

danielsharvey opened this issue Jun 19, 2018 · 2 comments

Comments

@danielsharvey
Copy link
Contributor

Sails version: v1.0.2
Node version: v10.2.1
NPM version: 6.1.0
DB adapter name: N/A
DB adapter version: N/A
Operating system: MacOS 10.13.5


I'm not sure if this is something that can be addressed by the sails-hook-custom-blueprints hook (I have submitted an issue) or needs attention in the sails project.

When I use the sails-hook-custom-blueprints hook to register a search.js blueprint, I am expecting to route

http://localhost:1337/api/v2/modelname/search

to the new blueprint.

However, this appears to be masked by the /:id route in sails:

_bindRestRoute('get %s/:id', 'findOne');

Is this the expected behaviour? It seems that this makes new (not one of the standard blueprint actions) blueprints unworkable.

Or, is the only way to override findOne and filter for my new action, passing back to the core implementation (!!) by default? (this does not seem optimal)

@sailsbot
Copy link

@danielsharvey Thanks for posting, we'll take a look as soon as possible.


For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.

@johnabrams7
Copy link
Contributor

johnabrams7 commented Nov 16, 2018

@danielsharvey It's possible the custom hook for this route is not being implemented correctly. Have you double checked the hook specification for .routes to make sure everything is configured correctly? It sounds like the blueprints are still defaulting back to the fineOne route instead of the custom blueprint for http://localhost:1337/api/v2/modelname/search.

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

No branches or pull requests

4 participants