-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Configurable API route #322
Comments
Have you looked at the I think adding this to that file will get you the result you want: 'post /api/tasks/create': {
controller: 'tasks',
action: 'create'
} |
That's reasonable of course... But we lose the nice automagic REST stuff. |
@obrienmd yeah :\ Got any ideas on how to resolve this? Maybe the following (assuming the entity is 'task', e.g. model is // in config/routes.js
`/api/tasks': {
controller: 'task'
} Right now, the example above would route |
Right - Was hoping to shift the entire blueprint... Not sure about the balance of consistency (i.e. should socket.io calls also be re-routed?) vs complexity. This is my first real day hacking on this, so I don't have any great ideas to submit. Just a through from reading the constant barrage of 'REST API design' blog posts over the last 6 months :) |
I think this would be a nice solution for changing the rest endpoint:
It would just switch all the default routes from |
I could get behind that. |
Also support for api versioning would be great. Something like: |
While it's not bullet-proof - you can achieve that now @joafeldmann with:
|
Can I suggest we do something like this
I'm not [yet] familiar with the codebase, but adding something like namespace shouldn't break backward compatibility while adding a url prefix. The default setting in the code could be |
Check out the hooks branch and how this is implemented in the 'controllers' hook-- I haven't made it configurable for controller yet, and there I've got a 'prefix' config, so you can control all blueprints at once, but I rather like your approach here better for individual controllers! Mike's phone On Jun 15, 2013, at 14:25, Nico notifications@github.com wrote:
|
http://sailsjs.org/#!documentation/config.controllers |
Just a heads up-- I'm planning on adding a per-controller override for the blueprint configs ( |
Does it make sense to allow the API route to be configurable, so instead of '/tasks/create' you could prepend something, like '/api/tasks/create'?
The text was updated successfully, but these errors were encountered: