Skip to content

Conversation

@SimonOneNineEight
Copy link
Collaborator

餐廳網站

餐廳網站連結
餐廳網站後台

帳號 / 密碼: admin / admin

hw2

完成餐廳網站 menu 功能,但是因為上傳圖片研究不出來,所以只能上傳圖片網址。

hw3

完成 FAQ 後台

app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(session({
secret: 'keyboard cat',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個應該放在環境變數才對,如同 secret 字面上的意思

req.flash('errorMessage', '更新文章失敗')
return res.redirect(`/update/${ArticleId}`)
})
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以稍微排版一下,比如說

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}`)
        })
}

down: async (queryInterface, Sequelize) => {
return queryInterface.bulkDelete('Users', null, {});
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個檔案是不是不小心上傳了 XD

down: async (queryInterface, Sequelize) => {
return queryInterface.bulkDelete('Users', null, {});
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個也是

"host": "127.0.0.1",
"dialect": "mysql"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個檔案要加進 .gitignore 才對

})
},

get: (req, res) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

命名可以更清楚一點,比如說 getArticle,這一部分可以參考其他同學的命名

@ClayGao
Copy link
Contributor

ClayGao commented Nov 7, 2020

這邊沒有部落格作業的連結,再麻煩同學提供了 :)

目前整體看下來,大部分同學犯的錯誤,同學這邊都沒有犯,但就是一些關鍵檔案不小心上傳上來了,這邊不可不慎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants