# bat_tu **Repository Path**: bat-coding/bat_tu ## Basic Information - **Project Name**: bat_tu - **Description**: Nest + Vue 视频网站 - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-09-22 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # bat_tu #### 介绍 Nest + Vue 视频网站 #### 软件架构 软件架构说明 #### 安装教程 1. 安装nest ```shell # npm 安装 npm i -g @nestjs/cli # yarn 安装 yarn add global @nestjs/cli ``` 2. 安装server ```shell # 安装server 并切换到server目录 nest new server && cd server # 选择安装源,可用 npm 或 yarn ``` 3. 创建子应用 ```shell # 创建子应用 admin nest g app admin ``` 4. 启动项目 ```shell # 启动服务 nest start -w admin ``` 5. 创建库 ```shell # 创建库 db库 nest g lib db # 修改默认名@app为@libs ``` 6. 在代码中引入db模块 ```typescript # 修改文件 server/apps/admin/src/app.module.ts import { DbModule } from '@libs/db' @Module({ imports: [ DbModule ] }) ``` 7. 安装数据库模块 ```shell # npm 安装 npm i nestjs-typegoose @typegoose/typegoose mongoose @types/mongoose # yarn 安装 yarn add nestjs-typegoose @typegoose/typegoose mongoose @types/mongoose ``` 8. 修改数据库连接文件 ```typescript # 修改 server/libs/db/src/db.module.ts import { TypegooseModule } from 'nestjs-typegoose' const models = TypegooseModule.forFeature([User]) @Global() @Module({ imports:[ TypegooseModule.forRoot('mongodb://localhost/topfullstack', { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false }) ], }) ``` 9. 创建子模块 ```shell # -p project 指定项目 nest g mo -p admin users ``` 10. 创建控制器 ```shell # -p project 指定项目 nest g co -p admin users ``` 11. 安装crud ```shell # npm 安装 npm i nestjs-mongoose-crud # yarn 安装 yarn add nestjs-mongoose-crud ``` 12. 安装swagger ```shell # npm 安装 npm i @nestjs/swagger swagger-ui-express # yarn 安装 yarn add @nestjs/swagger swagger-ui-express ``` 13. 更新依赖包 ```shell # 手动选择更新依赖 yarn upgrade-interactive --lastest ``` #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)