{"action":"created","comment":{"url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/comments/27201994","id":27201994,"diff_hunk":"@@ -19,6 +19,80 @@ comments: true\n permalink: comment-a-t-on-bouchonne-les-developpeurs-backend.html\n ---\n \n+\n+At M6Web we are curretly working on a new version of a web with two separated teams: \n+- backend team providing data access throught APIs,\n+- we, the frontend team, building an [isomorphic][isomorphic]SPA application using [React.JS][react-website] and the [flux pattern][flux-website]\n+  \n+# Develop frontend before the APIs\n+  \n+We started the projet at the same time than the other backend team. So, at the time, we didnt had the web services needeed for our application. We asked ourselves for the best way to develop the application without waiting thoses webservices availables.\n+  \n+# Interface\n+  \n+Out technical choice for the SPA has been guided by a deep thinking about isomorphic applications. This approach, React, FLux and all the environment around, was at the time, totally unknown. \n+  \n+The time allowed the backend team to describe the output of the API. With those informations, we writted fixtures files. The idea was having datas on a non existent web service.\n+  \n+# Superagent and superagent-mock\n+  \n+To request the API we use the [superagent][superagent] library, a Javascript HTTP client extensible easily. He's isopmorhic, so ha can be used serverd site or client side.\n+  \n+We developed [superagent-mock][superagent-mock], un superagent plugin dedicated to simulate HTTP request returning fixtures datas.\n+  \n+# application\n+  \n+Like superagent, superagent-mock can be installed via npm, et be used by server or client side libraries. You need first to add the ___ in your `package.json`.\n+  \n+{% highlight bash %}\n+npm install superagent-mock --save-dev\n+{% endhighlight %}  \n+\n+Then, we create the configuration file. It's here, you will decide wich data will be mocked. Let's take for exemple a non existant API, the authors list on our technical blog : `http://tech.m6web.fr/api/authors`.","path":"_posts/2015-03-30-superagent-mock.md","position":33,"original_position":33,"commit_id":"450d8bb8bcbb388b31e686cdea192a8e0d991952","original_commit_id":"450d8bb8bcbb388b31e686cdea192a8e0d991952","user":{"login":"mguillermin","id":252093,"avatar_url":"https://avatars.githubusercontent.com/u/252093?v=3","gravatar_id":"","url":"https://api.github.com/users/mguillermin","html_url":"https://github.com/mguillermin","followers_url":"https://api.github.com/users/mguillermin/followers","following_url":"https://api.github.com/users/mguillermin/following{/other_user}","gists_url":"https://api.github.com/users/mguillermin/gists{/gist_id}","starred_url":"https://api.github.com/users/mguillermin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mguillermin/subscriptions","organizations_url":"https://api.github.com/users/mguillermin/orgs","repos_url":"https://api.github.com/users/mguillermin/repos","events_url":"https://api.github.com/users/mguillermin/events{/privacy}","received_events_url":"https://api.github.com/users/mguillermin/received_events","type":"User","site_admin":false},"body":"il faut décider entre utiliser le \"we\" ou le \"you\" pour éviter le mix des 2","created_at":"2015-03-26T10:34:51Z","updated_at":"2015-03-26T10:34:51Z","html_url":"https://github.com/M6Web/m6web.github.io/pull/90#discussion_r27201994","pull_request_url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90","_links":{"self":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/comments/27201994"},"html":{"href":"https://github.com/M6Web/m6web.github.io/pull/90#discussion_r27201994"},"pull_request":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90"}}},"pull_request":{"url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90","id":32004497,"html_url":"https://github.com/M6Web/m6web.github.io/pull/90","diff_url":"https://github.com/M6Web/m6web.github.io/pull/90.diff","patch_url":"https://github.com/M6Web/m6web.github.io/pull/90.patch","issue_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues/90","number":90,"state":"open","locked":false,"title":"WIP - post in english","user":{"login":"omansour","id":1131098,"avatar_url":"https://avatars.githubusercontent.com/u/1131098?v=3","gravatar_id":"","url":"https://api.github.com/users/omansour","html_url":"https://github.com/omansour","followers_url":"https://api.github.com/users/omansour/followers","following_url":"https://api.github.com/users/omansour/following{/other_user}","gists_url":"https://api.github.com/users/omansour/gists{/gist_id}","starred_url":"https://api.github.com/users/omansour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omansour/subscriptions","organizations_url":"https://api.github.com/users/omansour/orgs","repos_url":"https://api.github.com/users/omansour/repos","events_url":"https://api.github.com/users/omansour/events{/privacy}","received_events_url":"https://api.github.com/users/omansour/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-26T10:25:54Z","updated_at":"2015-03-26T10:34:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de759afd93102407623b13b8f078f6f745311300","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90/commits","review_comments_url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90/comments","review_comment_url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues/90/comments","statuses_url":"https://api.github.com/repos/M6Web/m6web.github.io/statuses/450d8bb8bcbb388b31e686cdea192a8e0d991952","head":{"label":"M6Web:post/superagent-mock-en","ref":"post/superagent-mock-en","sha":"450d8bb8bcbb388b31e686cdea192a8e0d991952","user":{"login":"M6Web","id":1485147,"avatar_url":"https://avatars.githubusercontent.com/u/1485147?v=3","gravatar_id":"","url":"https://api.github.com/users/M6Web","html_url":"https://github.com/M6Web","followers_url":"https://api.github.com/users/M6Web/followers","following_url":"https://api.github.com/users/M6Web/following{/other_user}","gists_url":"https://api.github.com/users/M6Web/gists{/gist_id}","starred_url":"https://api.github.com/users/M6Web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/M6Web/subscriptions","organizations_url":"https://api.github.com/users/M6Web/orgs","repos_url":"https://api.github.com/users/M6Web/repos","events_url":"https://api.github.com/users/M6Web/events{/privacy}","received_events_url":"https://api.github.com/users/M6Web/received_events","type":"Organization","site_admin":false},"repo":{"id":14793179,"name":"m6web.github.io","full_name":"M6Web/m6web.github.io","owner":{"login":"M6Web","id":1485147,"avatar_url":"https://avatars.githubusercontent.com/u/1485147?v=3","gravatar_id":"","url":"https://api.github.com/users/M6Web","html_url":"https://github.com/M6Web","followers_url":"https://api.github.com/users/M6Web/followers","following_url":"https://api.github.com/users/M6Web/following{/other_user}","gists_url":"https://api.github.com/users/M6Web/gists{/gist_id}","starred_url":"https://api.github.com/users/M6Web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/M6Web/subscriptions","organizations_url":"https://api.github.com/users/M6Web/orgs","repos_url":"https://api.github.com/users/M6Web/repos","events_url":"https://api.github.com/users/M6Web/events{/privacy}","received_events_url":"https://api.github.com/users/M6Web/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/M6Web/m6web.github.io","description":"M6Web Tech Blog","fork":false,"url":"https://api.github.com/repos/M6Web/m6web.github.io","forks_url":"https://api.github.com/repos/M6Web/m6web.github.io/forks","keys_url":"https://api.github.com/repos/M6Web/m6web.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/M6Web/m6web.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/M6Web/m6web.github.io/teams","hooks_url":"https://api.github.com/repos/M6Web/m6web.github.io/hooks","issue_events_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/M6Web/m6web.github.io/events","assignees_url":"https://api.github.com/repos/M6Web/m6web.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/M6Web/m6web.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/M6Web/m6web.github.io/tags","blobs_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/M6Web/m6web.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/M6Web/m6web.github.io/languages","stargazers_url":"https://api.github.com/repos/M6Web/m6web.github.io/stargazers","contributors_url":"https://api.github.com/repos/M6Web/m6web.github.io/contributors","subscribers_url":"https://api.github.com/repos/M6Web/m6web.github.io/subscribers","subscription_url":"https://api.github.com/repos/M6Web/m6web.github.io/subscription","commits_url":"https://api.github.com/repos/M6Web/m6web.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/M6Web/m6web.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/M6Web/m6web.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/M6Web/m6web.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/M6Web/m6web.github.io/merges","archive_url":"https://api.github.com/repos/M6Web/m6web.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/M6Web/m6web.github.io/downloads","issues_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/M6Web/m6web.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/M6Web/m6web.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/M6Web/m6web.github.io/labels{/name}","releases_url":"https://api.github.com/repos/M6Web/m6web.github.io/releases{/id}","created_at":"2013-11-29T05:09:06Z","updated_at":"2015-03-16T16:10:49Z","pushed_at":"2015-03-26T10:26:46Z","git_url":"git://github.com/M6Web/m6web.github.io.git","ssh_url":"git@github.com:M6Web/m6web.github.io.git","clone_url":"https://github.com/M6Web/m6web.github.io.git","svn_url":"https://github.com/M6Web/m6web.github.io","homepage":"tech.m6web.fr","size":40224,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":2,"forks":10,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"M6Web:post/superagent-mock","ref":"post/superagent-mock","sha":"7e8d1c27e286bbd6ed67301a3c83181aabd0591b","user":{"login":"M6Web","id":1485147,"avatar_url":"https://avatars.githubusercontent.com/u/1485147?v=3","gravatar_id":"","url":"https://api.github.com/users/M6Web","html_url":"https://github.com/M6Web","followers_url":"https://api.github.com/users/M6Web/followers","following_url":"https://api.github.com/users/M6Web/following{/other_user}","gists_url":"https://api.github.com/users/M6Web/gists{/gist_id}","starred_url":"https://api.github.com/users/M6Web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/M6Web/subscriptions","organizations_url":"https://api.github.com/users/M6Web/orgs","repos_url":"https://api.github.com/users/M6Web/repos","events_url":"https://api.github.com/users/M6Web/events{/privacy}","received_events_url":"https://api.github.com/users/M6Web/received_events","type":"Organization","site_admin":false},"repo":{"id":14793179,"name":"m6web.github.io","full_name":"M6Web/m6web.github.io","owner":{"login":"M6Web","id":1485147,"avatar_url":"https://avatars.githubusercontent.com/u/1485147?v=3","gravatar_id":"","url":"https://api.github.com/users/M6Web","html_url":"https://github.com/M6Web","followers_url":"https://api.github.com/users/M6Web/followers","following_url":"https://api.github.com/users/M6Web/following{/other_user}","gists_url":"https://api.github.com/users/M6Web/gists{/gist_id}","starred_url":"https://api.github.com/users/M6Web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/M6Web/subscriptions","organizations_url":"https://api.github.com/users/M6Web/orgs","repos_url":"https://api.github.com/users/M6Web/repos","events_url":"https://api.github.com/users/M6Web/events{/privacy}","received_events_url":"https://api.github.com/users/M6Web/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/M6Web/m6web.github.io","description":"M6Web Tech Blog","fork":false,"url":"https://api.github.com/repos/M6Web/m6web.github.io","forks_url":"https://api.github.com/repos/M6Web/m6web.github.io/forks","keys_url":"https://api.github.com/repos/M6Web/m6web.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/M6Web/m6web.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/M6Web/m6web.github.io/teams","hooks_url":"https://api.github.com/repos/M6Web/m6web.github.io/hooks","issue_events_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/M6Web/m6web.github.io/events","assignees_url":"https://api.github.com/repos/M6Web/m6web.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/M6Web/m6web.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/M6Web/m6web.github.io/tags","blobs_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/M6Web/m6web.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/M6Web/m6web.github.io/languages","stargazers_url":"https://api.github.com/repos/M6Web/m6web.github.io/stargazers","contributors_url":"https://api.github.com/repos/M6Web/m6web.github.io/contributors","subscribers_url":"https://api.github.com/repos/M6Web/m6web.github.io/subscribers","subscription_url":"https://api.github.com/repos/M6Web/m6web.github.io/subscription","commits_url":"https://api.github.com/repos/M6Web/m6web.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/M6Web/m6web.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/M6Web/m6web.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/M6Web/m6web.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/M6Web/m6web.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/M6Web/m6web.github.io/merges","archive_url":"https://api.github.com/repos/M6Web/m6web.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/M6Web/m6web.github.io/downloads","issues_url":"https://api.github.com/repos/M6Web/m6web.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/M6Web/m6web.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/M6Web/m6web.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/M6Web/m6web.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/M6Web/m6web.github.io/labels{/name}","releases_url":"https://api.github.com/repos/M6Web/m6web.github.io/releases{/id}","created_at":"2013-11-29T05:09:06Z","updated_at":"2015-03-16T16:10:49Z","pushed_at":"2015-03-26T10:26:46Z","git_url":"git://github.com/M6Web/m6web.github.io.git","ssh_url":"git@github.com:M6Web/m6web.github.io.git","clone_url":"https://github.com/M6Web/m6web.github.io.git","svn_url":"https://github.com/M6Web/m6web.github.io","homepage":"tech.m6web.fr","size":40224,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":2,"forks":10,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90"},"html":{"href":"https://github.com/M6Web/m6web.github.io/pull/90"},"issue":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/issues/90"},"comments":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/issues/90/comments"},"review_comments":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90/comments"},"review_comment":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/pulls/90/commits"},"statuses":{"href":"https://api.github.com/repos/M6Web/m6web.github.io/statuses/450d8bb8bcbb388b31e686cdea192a8e0d991952"}}}}