{"action":"created","issue":{"url":"https://api.github.com/repos/nswbmw/N-blog/issues/107","repository_url":"https://api.github.com/repos/nswbmw/N-blog","labels_url":"https://api.github.com/repos/nswbmw/N-blog/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/nswbmw/N-blog/issues/107/comments","events_url":"https://api.github.com/repos/nswbmw/N-blog/issues/107/events","html_url":"https://github.com/nswbmw/N-blog/issues/107","id":123782897,"number":107,"title":"第一章发表文章报错","user":{"login":"hank2015","id":12546897,"avatar_url":"https://avatars.githubusercontent.com/u/12546897?v=3","gravatar_id":"","url":"https://api.github.com/users/hank2015","html_url":"https://github.com/hank2015","followers_url":"https://api.github.com/users/hank2015/followers","following_url":"https://api.github.com/users/hank2015/following{/other_user}","gists_url":"https://api.github.com/users/hank2015/gists{/gist_id}","starred_url":"https://api.github.com/users/hank2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hank2015/subscriptions","organizations_url":"https://api.github.com/users/hank2015/orgs","repos_url":"https://api.github.com/users/hank2015/repos","events_url":"https://api.github.com/users/hank2015/events{/privacy}","received_events_url":"https://api.github.com/users/hank2015/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2015-12-24T09:50:22Z","updated_at":"2016-11-03T09:38:06Z","closed_at":"2016-11-03T09:38:06Z","body":"![default](https://cloud.githubusercontent.com/assets/12546897/11992908/49ea9ac0-aa66-11e5-9dde-17714faa695d.png)\nindex.js文件\nrouter.get('/post', checkNotLogin);\nrouter.get('/post', function (req, res) {\n  res.render('post', { \n    title: '发表',\n     user: req.session.user,\n     success: req.flash('success').toString(),\n      error: req.flash('error').toString()\n    });\n});\n\nrouter.post('/post', checkLogin);\nrouter.post('/post', function (req, res) {\n    var currentUser = req.session.user,\n           post = new Post(req.body.post);\n\n```\npost.save(function (err) {\n  if (err) {\n    req.flash('error', err);\n    return res.redirect('/');\n  } \n  req.flash('success', '发布成功!');\n  res.redirect('/');\n});\n```\n\n});\nindex.html文件\n<% include header.html %>\n<% posts.forEach(function (post, index) { %>\n  <p><h2><a href=\"#\"><%= post.title %></a></h2></p>\n  <p class=\"info\">\n    作者：<a href=\"#\"><%= post.name %></a> | \n    日期：<%= post.time.minute %> | \n  </p>\n  <p><% post.post %></p>\n  <% }) %>\n<% include footer.html %>\n"},"comment":{"url":"https://api.github.com/repos/nswbmw/N-blog/issues/comments/258097517","html_url":"https://github.com/nswbmw/N-blog/issues/107#issuecomment-258097517","issue_url":"https://api.github.com/repos/nswbmw/N-blog/issues/107","id":258097517,"user":{"login":"nswbmw","id":4279697,"avatar_url":"https://avatars.githubusercontent.com/u/4279697?v=3","gravatar_id":"","url":"https://api.github.com/users/nswbmw","html_url":"https://github.com/nswbmw","followers_url":"https://api.github.com/users/nswbmw/followers","following_url":"https://api.github.com/users/nswbmw/following{/other_user}","gists_url":"https://api.github.com/users/nswbmw/gists{/gist_id}","starred_url":"https://api.github.com/users/nswbmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nswbmw/subscriptions","organizations_url":"https://api.github.com/users/nswbmw/orgs","repos_url":"https://api.github.com/users/nswbmw/repos","events_url":"https://api.github.com/users/nswbmw/events{/privacy}","received_events_url":"https://api.github.com/users/nswbmw/received_events","type":"User","site_admin":false},"created_at":"2016-11-03T09:38:06Z","updated_at":"2016-11-03T09:38:06Z","body":"教程已更新，请参考最新教程，见 [readme](https://github.com/nswbmw/N-blog)。"}}
{"actor":{"display_login":"nswbmw"}}