64f46039b34b2c52f084c3cc084b728e8b90eba2
Node Ledger
一个基于 Node.js 的轻量记账项目,包含:
- 命令行记账(新增、删除、列表、汇总)
- HTTP API(增删改查、汇总、分类统计)
- 前端页面(Vite 构建后由后端静态托管)
环境要求
- Node.js 20+
- npm 10+
本地运行
1. 安装前端依赖并构建
cd web
npm install
npm run build
cd ..
2. 启动服务
node index.js serve 3001
打开 http://localhost:3001。
常用命令
# 新增一条记录
node index.js add 50 午饭
# 查看记录(可按日期)
node index.js list
node index.js list --date 2026-05-01
# 汇总(可按日期)
node index.js sum
node index.js sum --date 2026-05-01
# 删除
node index.js remove <id>
API 示例
GET /api/entriesPOST /api/entriesPUT /api/entries/:idDELETE /api/entries/:idGET /api/summaryGET /api/stats/categories
部署
Ubuntu 服务器建议使用:
pm2守护 Node 进程nginx反向代理certbot配置 HTTPS
Description
Languages
JavaScript
84.5%
CSS
14%
HTML
1.5%