Week18 完成#20
Open
SimonOneNineEight wants to merge 5 commits into
Open
Conversation
ClayGao
reviewed
Nov 7, 2020
| app.use(bodyParser.urlencoded({ extended: false })) | ||
| app.use(bodyParser.json()) | ||
| app.use(session({ | ||
| secret: 'keyboard cat', |
Contributor
There was a problem hiding this comment.
這個應該放在環境變數才對,如同 secret 字面上的意思
ClayGao
reviewed
Nov 7, 2020
| req.flash('errorMessage', '更新文章失敗') | ||
| return res.redirect(`/update/${ArticleId}`) | ||
| }) | ||
| }, |
Contributor
There was a problem hiding this comment.
可以稍微排版一下,比如說
handleUpdateArticle = (req, res) => {
const ArticleId = req.params.id
const { title, TagId, content } = req.body
if (!title || !TagId || !content) {
req.flash('errorMessage', '請填入所有欄位')
return res.redirect(`/update/${ArticleId}`)
}
Article.update(
{
title,
TagId,
content,
},
{ where: { id: ArticleId } }
)
.then((newArticle) => {
res.redirect('/blog')
})
.catch((error) => {
console.log(error)
req.flash('errorMessage', '更新文章失敗')
return res.redirect(`/update/${ArticleId}`)
})
}
ClayGao
reviewed
Nov 7, 2020
| down: async (queryInterface, Sequelize) => { | ||
| return queryInterface.bulkDelete('Users', null, {}); | ||
| } | ||
| }; |
ClayGao
reviewed
Nov 7, 2020
| down: async (queryInterface, Sequelize) => { | ||
| return queryInterface.bulkDelete('Users', null, {}); | ||
| } | ||
| }; |
ClayGao
reviewed
Nov 7, 2020
| "host": "127.0.0.1", | ||
| "dialect": "mysql" | ||
| } | ||
| } |
ClayGao
reviewed
Nov 7, 2020
| }) | ||
| }, | ||
|
|
||
| get: (req, res) => { |
Contributor
There was a problem hiding this comment.
命名可以更清楚一點,比如說 getArticle,這一部分可以參考其他同學的命名
Contributor
|
這邊沒有部落格作業的連結,再麻煩同學提供了 :) 目前整體看下來,大部分同學犯的錯誤,同學這邊都沒有犯,但就是一些關鍵檔案不小心上傳上來了,這邊不可不慎 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
餐廳網站
餐廳網站連結
餐廳網站後台
帳號 / 密碼:admin / adminhw2
完成餐廳網站 menu 功能,但是因為上傳圖片研究不出來,所以只能上傳圖片網址。
hw3
完成 FAQ 後台