# niu-box **Repository Path**: youngniu/niu-box ## Basic Information - **Project Name**: niu-box - **Description**: 使用 koa 做后端的一个vue3学习项目,旨在建立一个在线收藏夹 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2022-11-18 - **Last Updated**: 2024-08-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vue3-koa 一个集成了前后端的项目。用于学习 vue3 & koa 。
前端: vue3 + vite2 + [ant-design-vue 2.0](https://2x.antdv.com/docs/vue/introduce-cn/) + vue-router 4.0 + vuex
服务端: koa2+mongodb
项目执行步骤: 1. 安装依赖 yarn 2. 打包 yarn build 3. 执行 node app.js 4. 访问正式环境: 5. 再执行 yarn dev,进入开发环境 服务端所用到的包: - koa - koa-router - koa-jwt - koa-router - koa-static - koa-bodyparser - mongoose - koa-json ## TODO ### 管理页面 ![](https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/1fae762bbdb245a88ce9cd7b74f03e11~tplv-k3u1fbpfcp-zoom-in-crop-mark:3024:0:0:0.awebp?) - [ ] 条件查询 - [x] 数据导入 - [x] 封面图上传(转换为Base64) ### 前台页面 ![](https://codeniu-picbed.oss-cn-hangzhou.aliyuncs.com/picbed/20230530113509.png) - [ ] 数据懒加载 - [ ] 评分功能 - [x] 分类查询 ### Feature - [ ] TS 重构 ### 密码 123 md5加密后 202cb962ac59075b964b07152d234b70 ## 部署 ### 数据库 在 `server\config\db.js` 下配置mongo路径: ```js const dbVMare = 'mongodb://codeniu:codeniu@192.168.146.129:27017/test?authSource=admin' ``` - 账号:codeniu - 密码:codeniu - 数据库名:test ### **Linux** 前提是你已经配置好了MongoDB ```shell node app.js ``` 访问 hostname:3308/niu-box ### **docker** 进入到项目目录执行: ```shell # 构建niu-box镜像 # Dockerfile 修改来源 #FROM node:16.18.0 docker build . -t codeniu/niu-box # 或者使用本地得node镜像构建 # Dockerfile 修改来源 # ARG BASE_IMAGE # FROM $BASE_IMAGE # 假设我们有一个名为 node:latest 的本地镜像 docker build --build-arg BASE_IMAGE=node:latest -t codeniu/niu-box . docker run -p 3308:3000 -d codeniu/niu-**box** ``` 访问 hostname:3308/niu-box ### docker compose 进入到项目目录执行: ```shell docker compose up -d ``` 如果你更改了 server\config\db.js 配置文件,单独启动web服务: ```shell docker-compose up -d --force-recreate web ```