-
-
Notifications
You must be signed in to change notification settings - Fork 743
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
Nested Routes #670
Comments
A little bit more information. I tried to setup exactly the same structure, for a different service, and it turns out to fail irrespective of the expected result (arrays or single items).
Even when I call /users/123/addresses and it does return a single addrress, the log still shows the same header error. Any ideas on what is possibly wrong with the nested routing? Thank you in advance. |
Does it work if you do something like: app.use('/users/:userId/addresses', {
find(params) {
return this.app.service('addresses').find({
query: Object.assign({
userId: params.userId
}, params.query);
});
},
setup(app) {
this.app = app;
}
}); ? |
Hi, |
I don't think it's your setup. I'm pretty sure it's related to #566 which will be fixed in the next version but causes some strange issues like yours at the moment. |
Ok, so for the time being, the correct solution is to implement nested routes as you pointed me out. I tried it on a different service, and it worked as well. My only question would be related to the other methods (create, patch,update), would I just implement like you did for the find? Thank you for your help. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs. |
Hi,
I have 2 services, Users and Addresses. I tried doing the Nested route example as in:
https://docs.feathersjs.com/faq/readme.html#how-do-i-do-nested-or-custom-routes
this results in:
/users/:userId/addresses
When a Users has only 1 address, it works. When the user has multiple addresses, I receive an error:
localhost didn’t send any data.
ERR_EMPTY_RESPONSE
However, if I do:
/addresses/?userID=xxxx
It works as expected for both single and multiple addresses.
All services are using sequelize/mysql.
I'm using:
"body-parser": "^1.17.2",
"compression": "^1.7.0",
"cors": "^2.8.4",
"feathers": "^2.1.7",
"feathers-authentication": "^1.2.7",
"feathers-authentication-hooks": "^0.1.4",
"feathers-authentication-jwt": "^0.3.2",
"feathers-authentication-local": "^0.4.3",
"feathers-configuration": "^0.4.1",
"feathers-errors": "^2.9.1",
"feathers-hooks": "^2.0.2",
"feathers-hooks-common": "^3.6.1",
"feathers-rest": "^1.8.0",
"feathers-sequelize": "^2.2.0",
"feathers-socketio": "^2.0.0",
"feathers-swagger": "^0.5.0",
"helmet": "^3.8.1",
"mysql2": "^1.4.0",
"sequelize": "^4.4.2",
"serve-favicon": "^2.4.3",
"skypager-service": "^5.4.0",
"winston": "^2.3.1"
The text was updated successfully, but these errors were encountered: