{"action":"created","comment":{"url":"https://api.github.com/repos/gs2-2/paper.hub/pulls/comments/46825226","id":46825226,"diff_hunk":"@@ -31,6 +32,78 @@ mongo.connect(\n \t}\n );\n \n+\n+/* serve everything in the folder './public/' */\n+app.use(express.static(__dirname + '/public'));\n+\n+//set up the multer specifications\n+var upload = multer(\n+\t\t//set the upload-destiantion for multer\n+\t\t{dest: './uploads',\n+\t\t//rename the file to avoid name conflicts\n+\t\trename: function(fieldname, filename) {\n+\t\t\treturn filename;\n+\t\t\t},\n+\t\t//log the start of the upload process\n+\t\tonFileUploadStart: function(file) {\n+\t\t\tconsole.log(file.originalname + 'upload started');\n+\t\t\t},\n+\t\t//log completed upload status\n+\t\tonFileUploadComplete: function(file) {\n+\t\t\tconsole.log(file.fieldname + 'uploaded to ' + file.path);\n+\t\t\tdone = true;\n+\t\t\t}\n+\t\t});\n+\n+\n+var uploadFile = upload.single('latexDocument');\n+\n+\n+/* Provide express route for the LaTeX Code commited by the user. Uploaded Latex file is converted to HTML and saved in FS and DB*/\n+app.post('/addPaper', uploadFile, function(req, res) {\n+\n+\t//create new paper instance in the DB\n+\tvar uploadedPaper = new publications({\n+\t\ttitle: req.body.title,\n+\t\tabstract: req.body.abstract,\n+\t\tauthor: req.body.author,\n+\t\tpublicationDate: new Date(),\n+\t\twidgets: [] //insert widgets, when they are generated after the upload\n+\t});\n+\n+\t//save the new publication in DB\n+\tuploadedPaper.save(function(error) {\n+\t\tvar message = error ? 'failed to save paper: ' + error \n+                            : 'paper saved: ' + uploadedPaper._id;\n+        console.log(message);\n+\t});\n+\n+\tvar paperID = uploadedPaper._id;\n+\n+\t//create a path for the new paper in the file system\n+\tutil.newPaperDir('./data/papers/', paperID, function(err) {\n+\t\tif(err) console.log(err);","path":"index.js","position":72,"original_position":72,"commit_id":"8aaec4de3185761a8743a92005f4b2b59cb32c5b","original_commit_id":"8aaec4de3185761a8743a92005f4b2b59cb32c5b","user":{"login":"noerw","id":7880552,"avatar_url":"https://avatars.githubusercontent.com/u/7880552?v=3","gravatar_id":"","url":"https://api.github.com/users/noerw","html_url":"https://github.com/noerw","followers_url":"https://api.github.com/users/noerw/followers","following_url":"https://api.github.com/users/noerw/following{/other_user}","gists_url":"https://api.github.com/users/noerw/gists{/gist_id}","starred_url":"https://api.github.com/users/noerw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noerw/subscriptions","organizations_url":"https://api.github.com/users/noerw/orgs","repos_url":"https://api.github.com/users/noerw/repos","events_url":"https://api.github.com/users/noerw/events{/privacy}","received_events_url":"https://api.github.com/users/noerw/received_events","type":"User","site_admin":false},"body":"asynchrone funktion!\r\ncode der danach laufen soll ins callback","created_at":"2015-12-07T14:23:26Z","updated_at":"2015-12-07T14:23:26Z","html_url":"https://github.com/gs2-2/paper.hub/pull/4#discussion_r46825226","pull_request_url":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/gs2-2/paper.hub/pulls/comments/46825226"},"html":{"href":"https://github.com/gs2-2/paper.hub/pull/4#discussion_r46825226"},"pull_request":{"href":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4","id":52842846,"html_url":"https://github.com/gs2-2/paper.hub/pull/4","diff_url":"https://github.com/gs2-2/paper.hub/pull/4.diff","patch_url":"https://github.com/gs2-2/paper.hub/pull/4.patch","issue_url":"https://api.github.com/repos/gs2-2/paper.hub/issues/4","number":4,"state":"open","locked":false,"title":"Latex routing","user":{"login":"LEinfeldt","id":12085492,"avatar_url":"https://avatars.githubusercontent.com/u/12085492?v=3","gravatar_id":"","url":"https://api.github.com/users/LEinfeldt","html_url":"https://github.com/LEinfeldt","followers_url":"https://api.github.com/users/LEinfeldt/followers","following_url":"https://api.github.com/users/LEinfeldt/following{/other_user}","gists_url":"https://api.github.com/users/LEinfeldt/gists{/gist_id}","starred_url":"https://api.github.com/users/LEinfeldt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LEinfeldt/subscriptions","organizations_url":"https://api.github.com/users/LEinfeldt/orgs","repos_url":"https://api.github.com/users/LEinfeldt/repos","events_url":"https://api.github.com/users/LEinfeldt/events{/privacy}","received_events_url":"https://api.github.com/users/LEinfeldt/received_events","type":"User","site_admin":false},"body":"Set the route for the upload of .tex files. The files are uploaded, saved in the file system and parsed to hmtl. The html file is saved in the dir of the paper.","created_at":"2015-12-07T13:14:32Z","updated_at":"2015-12-07T14:23:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2e8a236f0c3b6d46d08e85b1d523f34f4b576de","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4/commits","review_comments_url":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4/comments","review_comment_url":"https://api.github.com/repos/gs2-2/paper.hub/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gs2-2/paper.hub/issues/4/comments","statuses_url":"https://api.github.com/repos/gs2-2/paper.hub/statuses/8aaec4de3185761a8743a92005f4b2b59cb32c5b","head":{"label":"gs2-2:LatexRouting","ref":"LatexRouting","sha":"8aaec4de3185761a8743a92005f4b2b59cb32c5b","user":{"login":"gs2-2","id":15851600,"avatar_url":"https://avatars.githubusercontent.com/u/15851600?v=3","gravatar_id":"","url":"https://api.github.com/users/gs2-2","html_url":"https://github.com/gs2-2","followers_url":"https://api.github.com/users/gs2-2/followers","following_url":"https://api.github.com/users/gs2-2/following{/other_user}","gists_url":"https://api.github.com/users/gs2-2/gists{/gist_id}","starred_url":"https://api.github.com/users/gs2-2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gs2-2/subscriptions","organizations_url":"https://api.github.com/users/gs2-2/orgs","repos_url":"https://api.github.com/users/gs2-2/repos","events_url":"https://api.github.com/users/gs2-2/events{/privacy}","received_events_url":"https://api.github.com/users/gs2-2/received_events","type":"Organization","site_admin":false},"repo":{"id":46195750,"name":"paper.hub","full_name":"gs2-2/paper.hub","owner":{"login":"gs2-2","id":15851600,"avatar_url":"https://avatars.githubusercontent.com/u/15851600?v=3","gravatar_id":"","url":"https://api.github.com/users/gs2-2","html_url":"https://github.com/gs2-2","followers_url":"https://api.github.com/users/gs2-2/followers","following_url":"https://api.github.com/users/gs2-2/following{/other_user}","gists_url":"https://api.github.com/users/gs2-2/gists{/gist_id}","starred_url":"https://api.github.com/users/gs2-2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gs2-2/subscriptions","organizations_url":"https://api.github.com/users/gs2-2/orgs","repos_url":"https://api.github.com/users/gs2-2/repos","events_url":"https://api.github.com/users/gs2-2/events{/privacy}","received_events_url":"https://api.github.com/users/gs2-2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gs2-2/paper.hub","description":"","fork":false,"url":"https://api.github.com/repos/gs2-2/paper.hub","forks_url":"https://api.github.com/repos/gs2-2/paper.hub/forks","keys_url":"https://api.github.com/repos/gs2-2/paper.hub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gs2-2/paper.hub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gs2-2/paper.hub/teams","hooks_url":"https://api.github.com/repos/gs2-2/paper.hub/hooks","issue_events_url":"https://api.github.com/repos/gs2-2/paper.hub/issues/events{/number}","events_url":"https://api.github.com/repos/gs2-2/paper.hub/events","assignees_url":"https://api.github.com/repos/gs2-2/paper.hub/assignees{/user}","branches_url":"https://api.github.com/repos/gs2-2/paper.hub/branches{/branch}","tags_url":"https://api.github.com/repos/gs2-2/paper.hub/tags","blobs_url":"https://api.github.com/repos/gs2-2/paper.hub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gs2-2/paper.hub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gs2-2/paper.hub/git/refs{/sha}","trees_url":"https://api.github.com/repos/gs2-2/paper.hub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gs2-2/paper.hub/statuses/{sha}","languages_url":"https://api.github.com/repos/gs2-2/paper.hub/languages","stargazers_url":"https://api.github.com/repos/gs2-2/paper.hub/stargazers","contributors_url":"https://api.github.com/repos/gs2-2/paper.hub/contributors","subscribers_url":"https://api.github.com/repos/gs2-2/paper.hub/subscribers","subscription_url":"https://api.github.com/repos/gs2-2/paper.hub/subscription","commits_url":"https://api.github.com/repos/gs2-2/paper.hub/commits{/sha}","git_commits_url":"https://api.github.com/repos/gs2-2/paper.hub/git/commits{/sha}","comments_url":"https://api.github.com/repos/gs2-2/paper.hub/comments{/number}","issue_comment_url":"https://api.github.com/repos/gs2-2/paper.hub/issues/comments{/number}","contents_url":"https://api.github.com/repos/gs2-2/paper.hub/contents/{+path}","compare_url":"https://api.github.com/repos/gs2-2/paper.hub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gs2-2/paper.hub/merges","archive_url":"https://api.github.com/repos/gs2-2/paper.hub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gs2-2/paper.hub/downloads","issues_url":"https://api.github.com/repos/gs2-2/paper.hub/issues{/number}","pulls_url":"https://api.github.com/repos/gs2-2/paper.hub/pulls{/number}","milestones_url":"https://api.github.com/repos/gs2-2/paper.hub/milestones{/number}","notifications_url":"https://api.github.com/repos/gs2-2/paper.hub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gs2-2/paper.hub/labels{/name}","releases_url":"https://api.github.com/repos/gs2-2/paper.hub/releases{/id}","created_at":"2015-11-14T23:07:21Z","updated_at":"2015-12-06T09:23:20Z","pushed_at":"2015-12-07T14:11:32Z","git_url":"git://github.com/gs2-2/paper.hub.git","ssh_url":"git@github.com:gs2-2/paper.hub.git","clone_url":"https://github.com/gs2-2/paper.hub.git","svn_url":"https://github.com/gs2-2/paper.hub","homepage":null,"size":1248,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"gs2-2:master","ref":"master","sha":"36497b36c00cf98c9b45da476c7f5145b3b3bafe","user":{"login":"gs2-2","id":15851600,"avatar_url":"https://avatars.githubusercontent.com/u/15851600?v=3","gravatar_id":"","url":"https://api.github.com/users/gs2-2","html_url":"https://github.com/gs2-2","followers_url":"https://api.github.com/users/gs2-2/followers","following_url":"https://api.github.com/users/gs2-2/following{/other_user}","gists_url":"https://api.github.com/users/gs2-2/gists{/gist_id}","starred_url":"https://api.github.com/users/gs2-2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gs2-2/subscriptions","organizations_url":"https://api.github.com/users/gs2-2/orgs","repos_url":"https://api.github.com/users/gs2-2/repos","events_url":"https://api.github.com/users/gs2-2/events{/privacy}","received_events_url":"https://api.github.com/users/gs2-2/received_events","type":"Organization","site_admin":false},"repo":{"id":46195750,"name":"paper.hub","full_name":"gs2-2/paper.hub","owner":{"login":"gs2-2","id":15851600,"avatar_url":"https://avatars.githubusercontent.com/u/15851600?v=3","gravatar_id":"","url":"https://api.github.com/users/gs2-2","html_url":"https://github.com/gs2-2","followers_url":"https://api.github.com/users/gs2-2/followers","following_url":"https://api.github.com/users/gs2-2/following{/other_user}","gists_url":"https://api.github.com/users/gs2-2/gists{/gist_id}","starred_url":"https://api.github.com/users/gs2-2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gs2-2/subscriptions","organizations_url":"https://api.github.com/users/gs2-2/orgs","repos_url":"https://api.github.com/users/gs2-2/repos","events_url":"https://api.github.com/users/gs2-2/events{/privacy}","received_events_url":"https://api.github.com/users/gs2-2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gs2-2/paper.hub","description":"","fork":false,"url":"https://api.github.com/repos/gs2-2/paper.hub","forks_url":"https://api.github.com/repos/gs2-2/paper.hub/forks","keys_url":"https://api.github.com/repos/gs2-2/paper.hub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gs2-2/paper.hub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gs2-2/paper.hub/teams","hooks_url":"https://api.github.com/repos/gs2-2/paper.hub/hooks","issue_events_url":"https://api.github.com/repos/gs2-2/paper.hub/issues/events{/number}","events_url":"https://api.github.com/repos/gs2-2/paper.hub/events","assignees_url":"https://api.github.com/repos/gs2-2/paper.hub/assignees{/user}","branches_url":"https://api.github.com/repos/gs2-2/paper.hub/branches{/branch}","tags_url":"https://api.github.com/repos/gs2-2/paper.hub/tags","blobs_url":"https://api.github.com/repos/gs2-2/paper.hub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gs2-2/paper.hub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gs2-2/paper.hub/git/refs{/sha}","trees_url":"https://api.github.com/repos/gs2-2/paper.hub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gs2-2/paper.hub/statuses/{sha}","languages_url":"https://api.github.com/repos/gs2-2/paper.hub/languages","stargazers_url":"https://api.github.com/repos/gs2-2/paper.hub/stargazers","contributors_url":"https://api.github.com/repos/gs2-2/paper.hub/contributors","subscribers_url":"https://api.github.com/repos/gs2-2/paper.hub/subscribers","subscription_url":"https://api.github.com/repos/gs2-2/paper.hub/subscription","commits_url":"https://api.github.com/repos/gs2-2/paper.hub/commits{/sha}","git_commits_url":"https://api.github.com/repos/gs2-2/paper.hub/git/commits{/sha}","comments_url":"https://api.github.com/repos/gs2-2/paper.hub/comments{/number}","issue_comment_url":"https://api.github.com/repos/gs2-2/paper.hub/issues/comments{/number}","contents_url":"https://api.github.com/repos/gs2-2/paper.hub/contents/{+path}","compare_url":"https://api.github.com/repos/gs2-2/paper.hub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gs2-2/paper.hub/merges","archive_url":"https://api.github.com/repos/gs2-2/paper.hub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gs2-2/paper.hub/downloads","issues_url":"https://api.github.com/repos/gs2-2/paper.hub/issues{/number}","pulls_url":"https://api.github.com/repos/gs2-2/paper.hub/pulls{/number}","milestones_url":"https://api.github.com/repos/gs2-2/paper.hub/milestones{/number}","notifications_url":"https://api.github.com/repos/gs2-2/paper.hub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gs2-2/paper.hub/labels{/name}","releases_url":"https://api.github.com/repos/gs2-2/paper.hub/releases{/id}","created_at":"2015-11-14T23:07:21Z","updated_at":"2015-12-06T09:23:20Z","pushed_at":"2015-12-07T14:11:32Z","git_url":"git://github.com/gs2-2/paper.hub.git","ssh_url":"git@github.com:gs2-2/paper.hub.git","clone_url":"https://github.com/gs2-2/paper.hub.git","svn_url":"https://github.com/gs2-2/paper.hub","homepage":null,"size":1248,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4"},"html":{"href":"https://github.com/gs2-2/paper.hub/pull/4"},"issue":{"href":"https://api.github.com/repos/gs2-2/paper.hub/issues/4"},"comments":{"href":"https://api.github.com/repos/gs2-2/paper.hub/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/gs2-2/paper.hub/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gs2-2/paper.hub/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/gs2-2/paper.hub/statuses/8aaec4de3185761a8743a92005f4b2b59cb32c5b"}}}}