# atguigu_node_accounts **Repository Path**: ran-up/atguigu_node_accounts ## Basic Information - **Project Name**: atguigu_node_accounts - **Description**: 学习尚硅谷node时的记事本练习项目。 使用 express-generator 搭建 express 骨架,mongoose 连接 mongodb。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-04-05 - **Last Updated**: 2025-04-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 简介 学习 node 的一个非常简易的练习项目 -- 记账本 使用 node.js 开发,express-generator 搭建的 express 骨架,mongoose 连接的 mongodb # 使用到的技术 1. node.js 2. ejs 3. express 4. lowdb 5. mongodb 6. mongoose 7. express-session -- 管理 session 8. connect-mongo -- 管理 session 9. jsonwebtoken -- 管理 token 10. shortid -- 生成独一无二的 id 11. moment -- 将字符串时间变为时间对象 12. md5 # 项目 ## 初始化项目 1. 搭建项目:`express -e 项目名` 2. 安装依赖: `npm i` 3. 帐号:admin, 密码:admin ## 使用 lowdb 保存数据 -- 1_lowdb 1. 修改 package.json 中的启动方式: `"start": "node ./bin/www"` --> `"start": "nodemon ./1_lowdb/bin/www"` 2. 运行项目:`npm start`,浏览器输入:`http://localhost:3000/` 3. 在【routes】【index.js】设置路由 ```js // 记账列表 router.get('/account', function (req, res, next) { res.render('list') }) // 新增记账 router.get('/account/create', function (req, res, next) { res.render('create') }) ``` 4. 在【views】创建 list.ejs 和 create.ejs,将对应的 js 和 css 文件放到【public】中 > list.ejs 代码 ```html