1.更新博客接口 2.删除博客接口 3.登陆接口
router/blog.js
// 更新一篇博客 if (method === 'POST' && req.path ==='/api/blog/update') { const result = updateBlog(id, req.body) if (result) { return new SuccessModel() } else { return new ErrorModel('更新博客失败') } }controller/blog.js
// 更新博客处理逻辑 const updateBlog = (id, blogData = {}) => { console.log('update blog',id, blogData) return true }router/blog.js
// 删除一篇博客 if (method === 'POST' && req.path ==='/api/blog/delete') { const result = delBlog(id) if (result) { return new SuccessModel() } else { return new ErrorModel('删除博客失败') } }controller/blog.js
// 删除博客处理逻辑 const delBlog = (id) => { return true }controller/user.js
const loginCheck = (username, password) => { // 先使用假数据 if (username === 'zhangsan' && password === '123456') { return true } return false } module.exports = { loginCheck }