https://github.com/ansgoo/datavstore
https://github.com/ansgoo/datavstore
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ansgoo/datavstore
- Owner: AnsGoo
- Created: 2022-02-16T02:48:33.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-16T03:57:24.000Z (almost 4 years ago)
- Last Synced: 2025-01-31T14:48:03.172Z (11 months ago)
- Language: TypeScript
- Size: 188 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 技术栈
koa2 + typeorm + typescripts + mysql
## 全局依赖安装
```shell
npm install -g typescript
npm install -g ts-node
npm install -g nodemon
npm install -g typeorm
npm install -g pm2
```
## 安装依赖
```shell
npm install
```
## 修改配置文件
修改`ormconfig.json`里面的`mysql`连接信息
## 启动项目
1. 构建项目
```
npm run build
```
2. 打开调试模式
打开 vscode debug ,执行运行`Launch Program`
## 生成迁移文件
```shell
typeorm migration:generate -n Page
```
## 执行迁移文件
```shell
ts-node ./node_modules/typeorm/cli.js migration:run
```
## 开发模式下的运行
```shell
npm run start
```
**NOTE:** 建议非生产环境下的启动该项目采用这种方式,windows 系统终端不允许后台运行,一旦启动采用PM2 启动项目会导致终端无限闪启
## 部署
```shell
docker build -t dashboard-backend:v1 .
docker run -p 13000:3000 -v /opt/public:/home/marco/public --name dashboard-backend -it dashboard-backend:v1
```