{"action":"created","issue":{"url":"https://api.github.com/repos/trailsjs/trails/issues/84","labels_url":"https://api.github.com/repos/trailsjs/trails/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/trailsjs/trails/issues/84/comments","events_url":"https://api.github.com/repos/trailsjs/trails/issues/84/events","html_url":"https://github.com/trailsjs/trails/issues/84","id":126696895,"number":84,"title":"Provide client side library","user":{"login":"gutenye","id":377544,"avatar_url":"https://avatars.githubusercontent.com/u/377544?v=3","gravatar_id":"","url":"https://api.github.com/users/gutenye","html_url":"https://github.com/gutenye","followers_url":"https://api.github.com/users/gutenye/followers","following_url":"https://api.github.com/users/gutenye/following{/other_user}","gists_url":"https://api.github.com/users/gutenye/gists{/gist_id}","starred_url":"https://api.github.com/users/gutenye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gutenye/subscriptions","organizations_url":"https://api.github.com/users/gutenye/orgs","repos_url":"https://api.github.com/users/gutenye/repos","events_url":"https://api.github.com/users/gutenye/events{/privacy}","received_events_url":"https://api.github.com/users/gutenye/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-14T16:52:52Z","updated_at":"2016-01-15T02:11:40Z","closed_at":null,"body":"It'll be great if we can use same model files in both server and client side. There're something in common, e.g. properties, validation, custom methods\r\n\r\nMaybe something like [js-data](http://www.js-data.io/)?\r\nor automatically generated like [loopback](http://loopback.io/)"},"comment":{"url":"https://api.github.com/repos/trailsjs/trails/issues/comments/171848185","html_url":"https://github.com/trailsjs/trails/issues/84#issuecomment-171848185","issue_url":"https://api.github.com/repos/trailsjs/trails/issues/84","id":171848185,"user":{"login":"aclave1","id":1417877,"avatar_url":"https://avatars.githubusercontent.com/u/1417877?v=3","gravatar_id":"","url":"https://api.github.com/users/aclave1","html_url":"https://github.com/aclave1","followers_url":"https://api.github.com/users/aclave1/followers","following_url":"https://api.github.com/users/aclave1/following{/other_user}","gists_url":"https://api.github.com/users/aclave1/gists{/gist_id}","starred_url":"https://api.github.com/users/aclave1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aclave1/subscriptions","organizations_url":"https://api.github.com/users/aclave1/orgs","repos_url":"https://api.github.com/users/aclave1/repos","events_url":"https://api.github.com/users/aclave1/events{/privacy}","received_events_url":"https://api.github.com/users/aclave1/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T02:11:40Z","updated_at":"2016-01-15T02:11:40Z","body":"I have written some code to automate this for a past project and i plan to provide it as a trailpack. The way i did it in the past was, I added DTO classes to my sails.config.routes file, I then required this file into my client app and ran some code to extract the http method and route template, call the api library of my choice, new() the \"send\" DTO, pass in the parameters, and whatever comes back, new() the \"receive\" DTO. On the DTO i had validations and such which ran on the client and on the server.\r\n\r\n\r\nSo a sails.config.routes file looked something like this:\r\n\r\n{\r\n'get /url/:id',\r\ncontroller:'...'\r\nsend:CreateChatRoom, //js constructor function\r\nreceive:ChatRoom//js constructor function\r\n} \r\n\r\n"}}