1、nodemon 和 supervisor(推荐) 自动重启服务
使用:https://blog.csdn.net/LQS000/article/details/131286164
npm install nodemon -g
由于 nodemon 可能会导致端口占用,推荐 supervisor ,用法一样。
npm install supervisor
2、express 中间件
npm install express --save
3、express - generator 应用程序生成器
使用:https://blog.csdn.net/LQS000/article/details/131331725
npm install -g express-generator
4、express - formidable 处理文件上传
使用:https://blog.csdn.net/LQS000/article/details/131333322
npm install formidable@v2
5、EJS 模板引擎
使用:https://blog.csdn.net/LQS000/article/details/131291268
npm install ejs --save
6、lowdb 项目中基本不用,处理简单数据,了解即可。
使用:https://blog.csdn.net/LQS000/article/details/131343387
npm install lowdb@1.0.0
7、shortid 获取随机 id
使用:https://blog.csdn.net/LQS000/article/details/131355998
npm i shortid
8、mongodb 数据库
使用:https://blog.csdn.net/LQS000/article/details/131387372
9、mongoose 操作 mongodb 数据库
使用:https://blog.csdn.net/LQS000/article/details/131388736
npm i mongoose
10、json-server 工具
使用:https://blog.csdn.net/LQS000/article/details/131458832
npm i -g json-server
11、md5 加密工具(常用于密码)
npm i md5
const md5 = require('md5')
UserModel.create({ ...req.body, psw: md5(req.body.psw) }, (err, data) => {
if (err) {
res.status(500).send('注册失败~~');
return
}
res.render('success', { msg: '注册成功', url: '/login' })
})