{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/sails/issues/1160","repository_url":"https://api.github.com/repos/balderdashy/sails","labels_url":"https://api.github.com/repos/balderdashy/sails/issues/1160/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails/issues/1160/comments","events_url":"https://api.github.com/repos/balderdashy/sails/issues/1160/events","html_url":"https://github.com/balderdashy/sails/issues/1160","id":23558486,"number":1160,"title":"Feature Request: Dynamic Models at runtime!","user":{"login":"ArdentZeal","id":5508364,"avatar_url":"https://avatars.githubusercontent.com/u/5508364?v=3","gravatar_id":"","url":"https://api.github.com/users/ArdentZeal","html_url":"https://github.com/ArdentZeal","followers_url":"https://api.github.com/users/ArdentZeal/followers","following_url":"https://api.github.com/users/ArdentZeal/following{/other_user}","gists_url":"https://api.github.com/users/ArdentZeal/gists{/gist_id}","starred_url":"https://api.github.com/users/ArdentZeal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArdentZeal/subscriptions","organizations_url":"https://api.github.com/users/ArdentZeal/orgs","repos_url":"https://api.github.com/users/ArdentZeal/repos","events_url":"https://api.github.com/users/ArdentZeal/events{/privacy}","received_events_url":"https://api.github.com/users/ArdentZeal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/balderdashy/sails/milestones/2","html_url":"https://github.com/balderdashy/sails/milestones/Feature%20Requests%20/%20Ideas","labels_url":"https://api.github.com/repos/balderdashy/sails/milestones/2/labels","id":345428,"number":2,"title":"Feature Requests / Ideas","description":"Ideas for features / improvements","creator":{"login":"mikermcneil","id":618009,"avatar_url":"https://avatars.githubusercontent.com/u/618009?v=3","gravatar_id":"","url":"https://api.github.com/users/mikermcneil","html_url":"https://github.com/mikermcneil","followers_url":"https://api.github.com/users/mikermcneil/followers","following_url":"https://api.github.com/users/mikermcneil/following{/other_user}","gists_url":"https://api.github.com/users/mikermcneil/gists{/gist_id}","starred_url":"https://api.github.com/users/mikermcneil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikermcneil/subscriptions","organizations_url":"https://api.github.com/users/mikermcneil/orgs","repos_url":"https://api.github.com/users/mikermcneil/repos","events_url":"https://api.github.com/users/mikermcneil/events{/privacy}","received_events_url":"https://api.github.com/users/mikermcneil/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":191,"state":"open","created_at":"2013-05-31T07:24:00Z","updated_at":"2015-09-22T00:38:48Z","due_on":null,"closed_at":null},"comments":20,"created_at":"2013-12-02T08:38:34Z","updated_at":"2016-09-22T21:09:10Z","closed_at":"2014-05-20T00:47:23Z","body":"Hello dear Sails-Community,\r\n\r\nwe are developing a prototype for a new application in our company. We would like to be able to implement Sailsjs for all its nice features in the final product. So basically we want to change from the MEAN Stack in the prototype app to the MEANS Stack in the production app.\r\n\r\nWhile there are still some issues with Angular and Sails which are not perfect yet, there seems to be a workaround for most of them. Saddly there is one special requirement we would need, which seems to be nearly impossible at the moment.\r\n\r\nThe app is able to generate Database Schemata provided by the end-user \"on-the-fly\". Which means we need to be able to generate routing \"on-the-fly\" as well, which looks sth like this in the MEAN Stack.\r\n\r\n```js\r\nvar setupStaticRoutesForDynamicObject = function(dynamicObject) {\r\n\r\n    removeRouteToAngular();\r\n    var model_tol = dynamicObject.model.toLowerCase();\r\n\r\n    app.get(\"/api/\" + model_tol, RoutesDynamic.all(dynamicObject));\r\n    app.get(\"/api/\" + model_tol + \"/:id\", RoutesDynamic.show(dynamicObject));\r\n    app.post(\"/api/\" + model_tol, RoutesDynamic.create(dynamicObject));\r\n    app.put(\"/api/\"  + model_tol + \"/:id\", RoutesDynamic.update(dynamicObject));\r\n    app.del(\"/api/\"  + model_tol + \"/:id\", RoutesDynamic.del(dynamicObject));\r\n\r\n    addRouteToAngular();\r\n};\r\n```\r\n\r\nIs there a way this is already possible with Sailsjs and i am just too blind to see?\r\n\r\nthe second part ist the removeRouteToAngular(); and addRouteToAngular();. The angular app takes over routing, for anything but the dataapi and the index.html, so we need a catchAll block **at the end** to catch all routes not related to the dataapi and the index.html to be routed to angular. \r\n\r\nSo at the moment we remove the catchAll Route from app.routes, add our dynamic Routes, and add the catchAll again at the end. \r\n\r\nSome guidance on handling this behaviour in Sailsjs would be much appreciated.\r\n\r\nThanks for this amazing framework.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/balderdashy/sails/issues/comments/249028561","html_url":"https://github.com/balderdashy/sails/issues/1160#issuecomment-249028561","issue_url":"https://api.github.com/repos/balderdashy/sails/issues/1160","id":249028561,"user":{"login":"cburatto","id":7476929,"avatar_url":"https://avatars.githubusercontent.com/u/7476929?v=3","gravatar_id":"","url":"https://api.github.com/users/cburatto","html_url":"https://github.com/cburatto","followers_url":"https://api.github.com/users/cburatto/followers","following_url":"https://api.github.com/users/cburatto/following{/other_user}","gists_url":"https://api.github.com/users/cburatto/gists{/gist_id}","starred_url":"https://api.github.com/users/cburatto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cburatto/subscriptions","organizations_url":"https://api.github.com/users/cburatto/orgs","repos_url":"https://api.github.com/users/cburatto/repos","events_url":"https://api.github.com/users/cburatto/events{/privacy}","received_events_url":"https://api.github.com/users/cburatto/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T21:09:10Z","updated_at":"2016-09-22T21:09:10Z","body":"+1"}}
{"actor":{"display_login":"cburatto"}}