{"action":"created","comment":{"url":"https://api.github.com/repos/its-succ/rabbit-server/pulls/comments/48429388","id":48429388,"diff_hunk":"@@ -0,0 +1,16 @@\n+'use strict';\n+\n+const m = require('mithril');\n+\n+const Home = {\n+  view: () => {\n+    return <div>\n+            <h1>Rabbit</h1>\n+            <p>Welcome to Rabbit</p>\n+           </div>;\n+  }\n+};","path":"client/index.js","position":12,"original_position":12,"commit_id":"8175b0e9220a6ad3be0a40a436e90d1490c043d0","original_commit_id":"8175b0e9220a6ad3be0a40a436e90d1490c043d0","user":{"login":"fossamagna","id":1638848,"avatar_url":"https://avatars.githubusercontent.com/u/1638848?v=3","gravatar_id":"","url":"https://api.github.com/users/fossamagna","html_url":"https://github.com/fossamagna","followers_url":"https://api.github.com/users/fossamagna/followers","following_url":"https://api.github.com/users/fossamagna/following{/other_user}","gists_url":"https://api.github.com/users/fossamagna/gists{/gist_id}","starred_url":"https://api.github.com/users/fossamagna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossamagna/subscriptions","organizations_url":"https://api.github.com/users/fossamagna/orgs","repos_url":"https://api.github.com/users/fossamagna/repos","events_url":"https://api.github.com/users/fossamagna/events{/privacy}","received_events_url":"https://api.github.com/users/fossamagna/received_events","type":"User","site_admin":false},"body":"Mithrilでは再利用可能なものは[コンポーネント](http://mithril-ja.js.org/components.html)として切り出します。\r\nまた、複数箇所で再利用しないけど、ネストが深くなるとかである部分だけ切り出したいとかいう場合もあるので、そういったときには、それを返す関数をつくって、それを必要な箇所で呼び出すようにします。\r\n\r\nうまく説明できなくて申し訳ないですが、端的に言うと、`view`関数ないで全部書ききる必要はないです。","created_at":"2015-12-25T02:19:33Z","updated_at":"2015-12-25T02:19:33Z","html_url":"https://github.com/its-succ/rabbit-server/pull/10#discussion_r48429388","pull_request_url":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/its-succ/rabbit-server/pulls/comments/48429388"},"html":{"href":"https://github.com/its-succ/rabbit-server/pull/10#discussion_r48429388"},"pull_request":{"href":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10","id":54064149,"html_url":"https://github.com/its-succ/rabbit-server/pull/10","diff_url":"https://github.com/its-succ/rabbit-server/pull/10.diff","patch_url":"https://github.com/its-succ/rabbit-server/pull/10.patch","issue_url":"https://api.github.com/repos/its-succ/rabbit-server/issues/10","number":10,"state":"open","locked":false,"title":"Mithrilを使えるようにした","user":{"login":"fossamagna","id":1638848,"avatar_url":"https://avatars.githubusercontent.com/u/1638848?v=3","gravatar_id":"","url":"https://api.github.com/users/fossamagna","html_url":"https://github.com/fossamagna","followers_url":"https://api.github.com/users/fossamagna/followers","following_url":"https://api.github.com/users/fossamagna/following{/other_user}","gists_url":"https://api.github.com/users/fossamagna/gists{/gist_id}","starred_url":"https://api.github.com/users/fossamagna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fossamagna/subscriptions","organizations_url":"https://api.github.com/users/fossamagna/orgs","repos_url":"https://api.github.com/users/fossamagna/repos","events_url":"https://api.github.com/users/fossamagna/events{/privacy}","received_events_url":"https://api.github.com/users/fossamagna/received_events","type":"User","site_admin":false},"body":"\r\n`client`ディレクトリにクライアントのjsファイルを配置するようにしました。\r\nビルドされたjsは`public/javascripts/bundle.js`として出力されるようにしてあります。expressがブラウザに提供するのはこの`bundle.js`ファイルです。\r\n\r\n```sh\r\n$ npm run build\r\n```\r\nでビルドできます。\r\n\r\n```sh\r\n$ npm run watch\r\n```\r\nとすると、client/*.jsが変更になったら、差分ビルドを実行して`public/javascripts/bundle.js`を更新するようになっています。開発中はこちらを使うほうが便利です。\r\n\r\nそれと、Mithrilのviewの定義をJavaScriptソースの中にHTML風に書ける拡張(MSXといいます)も入れてあります。これもビルド時にJavaScriptのソースに変換しています。\r\nMSXはHTML風にかけますが、HTMLとは違い閉じタグが必須(XMLと同じ)なので注意してください。","created_at":"2015-12-18T04:31:29Z","updated_at":"2015-12-25T02:19:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f1a581055293ab9d4be73fd8a192d9da180bb42","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10/commits","review_comments_url":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10/comments","review_comment_url":"https://api.github.com/repos/its-succ/rabbit-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/its-succ/rabbit-server/issues/10/comments","statuses_url":"https://api.github.com/repos/its-succ/rabbit-server/statuses/8175b0e9220a6ad3be0a40a436e90d1490c043d0","head":{"label":"its-succ:add-clinet-base","ref":"add-clinet-base","sha":"8175b0e9220a6ad3be0a40a436e90d1490c043d0","user":{"login":"its-succ","id":11204761,"avatar_url":"https://avatars.githubusercontent.com/u/11204761?v=3","gravatar_id":"","url":"https://api.github.com/users/its-succ","html_url":"https://github.com/its-succ","followers_url":"https://api.github.com/users/its-succ/followers","following_url":"https://api.github.com/users/its-succ/following{/other_user}","gists_url":"https://api.github.com/users/its-succ/gists{/gist_id}","starred_url":"https://api.github.com/users/its-succ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/its-succ/subscriptions","organizations_url":"https://api.github.com/users/its-succ/orgs","repos_url":"https://api.github.com/users/its-succ/repos","events_url":"https://api.github.com/users/its-succ/events{/privacy}","received_events_url":"https://api.github.com/users/its-succ/received_events","type":"Organization","site_admin":false},"repo":{"id":42282256,"name":"rabbit-server","full_name":"its-succ/rabbit-server","owner":{"login":"its-succ","id":11204761,"avatar_url":"https://avatars.githubusercontent.com/u/11204761?v=3","gravatar_id":"","url":"https://api.github.com/users/its-succ","html_url":"https://github.com/its-succ","followers_url":"https://api.github.com/users/its-succ/followers","following_url":"https://api.github.com/users/its-succ/following{/other_user}","gists_url":"https://api.github.com/users/its-succ/gists{/gist_id}","starred_url":"https://api.github.com/users/its-succ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/its-succ/subscriptions","organizations_url":"https://api.github.com/users/its-succ/orgs","repos_url":"https://api.github.com/users/its-succ/repos","events_url":"https://api.github.com/users/its-succ/events{/privacy}","received_events_url":"https://api.github.com/users/its-succ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/its-succ/rabbit-server","description":"","fork":false,"url":"https://api.github.com/repos/its-succ/rabbit-server","forks_url":"https://api.github.com/repos/its-succ/rabbit-server/forks","keys_url":"https://api.github.com/repos/its-succ/rabbit-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/its-succ/rabbit-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/its-succ/rabbit-server/teams","hooks_url":"https://api.github.com/repos/its-succ/rabbit-server/hooks","issue_events_url":"https://api.github.com/repos/its-succ/rabbit-server/issues/events{/number}","events_url":"https://api.github.com/repos/its-succ/rabbit-server/events","assignees_url":"https://api.github.com/repos/its-succ/rabbit-server/assignees{/user}","branches_url":"https://api.github.com/repos/its-succ/rabbit-server/branches{/branch}","tags_url":"https://api.github.com/repos/its-succ/rabbit-server/tags","blobs_url":"https://api.github.com/repos/its-succ/rabbit-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/its-succ/rabbit-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/its-succ/rabbit-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/its-succ/rabbit-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/its-succ/rabbit-server/statuses/{sha}","languages_url":"https://api.github.com/repos/its-succ/rabbit-server/languages","stargazers_url":"https://api.github.com/repos/its-succ/rabbit-server/stargazers","contributors_url":"https://api.github.com/repos/its-succ/rabbit-server/contributors","subscribers_url":"https://api.github.com/repos/its-succ/rabbit-server/subscribers","subscription_url":"https://api.github.com/repos/its-succ/rabbit-server/subscription","commits_url":"https://api.github.com/repos/its-succ/rabbit-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/its-succ/rabbit-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/its-succ/rabbit-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/its-succ/rabbit-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/its-succ/rabbit-server/contents/{+path}","compare_url":"https://api.github.com/repos/its-succ/rabbit-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/its-succ/rabbit-server/merges","archive_url":"https://api.github.com/repos/its-succ/rabbit-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/its-succ/rabbit-server/downloads","issues_url":"https://api.github.com/repos/its-succ/rabbit-server/issues{/number}","pulls_url":"https://api.github.com/repos/its-succ/rabbit-server/pulls{/number}","milestones_url":"https://api.github.com/repos/its-succ/rabbit-server/milestones{/number}","notifications_url":"https://api.github.com/repos/its-succ/rabbit-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/its-succ/rabbit-server/labels{/name}","releases_url":"https://api.github.com/repos/its-succ/rabbit-server/releases{/id}","created_at":"2015-09-11T02:17:21Z","updated_at":"2015-12-18T02:39:08Z","pushed_at":"2015-12-18T04:31:30Z","git_url":"git://github.com/its-succ/rabbit-server.git","ssh_url":"git@github.com:its-succ/rabbit-server.git","clone_url":"https://github.com/its-succ/rabbit-server.git","svn_url":"https://github.com/its-succ/rabbit-server","homepage":null,"size":23,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"its-succ:master","ref":"master","sha":"1c7f2db44f1f2c51570b6d600c869e569a7e085d","user":{"login":"its-succ","id":11204761,"avatar_url":"https://avatars.githubusercontent.com/u/11204761?v=3","gravatar_id":"","url":"https://api.github.com/users/its-succ","html_url":"https://github.com/its-succ","followers_url":"https://api.github.com/users/its-succ/followers","following_url":"https://api.github.com/users/its-succ/following{/other_user}","gists_url":"https://api.github.com/users/its-succ/gists{/gist_id}","starred_url":"https://api.github.com/users/its-succ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/its-succ/subscriptions","organizations_url":"https://api.github.com/users/its-succ/orgs","repos_url":"https://api.github.com/users/its-succ/repos","events_url":"https://api.github.com/users/its-succ/events{/privacy}","received_events_url":"https://api.github.com/users/its-succ/received_events","type":"Organization","site_admin":false},"repo":{"id":42282256,"name":"rabbit-server","full_name":"its-succ/rabbit-server","owner":{"login":"its-succ","id":11204761,"avatar_url":"https://avatars.githubusercontent.com/u/11204761?v=3","gravatar_id":"","url":"https://api.github.com/users/its-succ","html_url":"https://github.com/its-succ","followers_url":"https://api.github.com/users/its-succ/followers","following_url":"https://api.github.com/users/its-succ/following{/other_user}","gists_url":"https://api.github.com/users/its-succ/gists{/gist_id}","starred_url":"https://api.github.com/users/its-succ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/its-succ/subscriptions","organizations_url":"https://api.github.com/users/its-succ/orgs","repos_url":"https://api.github.com/users/its-succ/repos","events_url":"https://api.github.com/users/its-succ/events{/privacy}","received_events_url":"https://api.github.com/users/its-succ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/its-succ/rabbit-server","description":"","fork":false,"url":"https://api.github.com/repos/its-succ/rabbit-server","forks_url":"https://api.github.com/repos/its-succ/rabbit-server/forks","keys_url":"https://api.github.com/repos/its-succ/rabbit-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/its-succ/rabbit-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/its-succ/rabbit-server/teams","hooks_url":"https://api.github.com/repos/its-succ/rabbit-server/hooks","issue_events_url":"https://api.github.com/repos/its-succ/rabbit-server/issues/events{/number}","events_url":"https://api.github.com/repos/its-succ/rabbit-server/events","assignees_url":"https://api.github.com/repos/its-succ/rabbit-server/assignees{/user}","branches_url":"https://api.github.com/repos/its-succ/rabbit-server/branches{/branch}","tags_url":"https://api.github.com/repos/its-succ/rabbit-server/tags","blobs_url":"https://api.github.com/repos/its-succ/rabbit-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/its-succ/rabbit-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/its-succ/rabbit-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/its-succ/rabbit-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/its-succ/rabbit-server/statuses/{sha}","languages_url":"https://api.github.com/repos/its-succ/rabbit-server/languages","stargazers_url":"https://api.github.com/repos/its-succ/rabbit-server/stargazers","contributors_url":"https://api.github.com/repos/its-succ/rabbit-server/contributors","subscribers_url":"https://api.github.com/repos/its-succ/rabbit-server/subscribers","subscription_url":"https://api.github.com/repos/its-succ/rabbit-server/subscription","commits_url":"https://api.github.com/repos/its-succ/rabbit-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/its-succ/rabbit-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/its-succ/rabbit-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/its-succ/rabbit-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/its-succ/rabbit-server/contents/{+path}","compare_url":"https://api.github.com/repos/its-succ/rabbit-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/its-succ/rabbit-server/merges","archive_url":"https://api.github.com/repos/its-succ/rabbit-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/its-succ/rabbit-server/downloads","issues_url":"https://api.github.com/repos/its-succ/rabbit-server/issues{/number}","pulls_url":"https://api.github.com/repos/its-succ/rabbit-server/pulls{/number}","milestones_url":"https://api.github.com/repos/its-succ/rabbit-server/milestones{/number}","notifications_url":"https://api.github.com/repos/its-succ/rabbit-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/its-succ/rabbit-server/labels{/name}","releases_url":"https://api.github.com/repos/its-succ/rabbit-server/releases{/id}","created_at":"2015-09-11T02:17:21Z","updated_at":"2015-12-18T02:39:08Z","pushed_at":"2015-12-18T04:31:30Z","git_url":"git://github.com/its-succ/rabbit-server.git","ssh_url":"git@github.com:its-succ/rabbit-server.git","clone_url":"https://github.com/its-succ/rabbit-server.git","svn_url":"https://github.com/its-succ/rabbit-server","homepage":null,"size":23,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10"},"html":{"href":"https://github.com/its-succ/rabbit-server/pull/10"},"issue":{"href":"https://api.github.com/repos/its-succ/rabbit-server/issues/10"},"comments":{"href":"https://api.github.com/repos/its-succ/rabbit-server/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/its-succ/rabbit-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/its-succ/rabbit-server/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/its-succ/rabbit-server/statuses/8175b0e9220a6ad3be0a40a436e90d1490c043d0"}}}}