项目使用教程
本文档简单介绍如何使用该项目。
前端项目地址: https://github.com/DuRuofu/Vue-Element-Admin-Templates 后端项目地址: https://github.com/DuRuofu/Node-Koa-Templates
运行后端
克隆代码:
sh
git clone https://github.com/DuRuofu/Node-Koa-Templates
下载依赖:
sh
npm i
配置环境变量:复制根目录下.env.example文件并重命名为.env,然后根据实际情况进行配置。
# 环境变量:
# Prismas数据库配置
# 格式: DATABASE_URL="postgresql://user:password@host:port/database"
# 示例
DATABASE_URL=mysql://root:12345678@localhost:3306/example_db
使用npm updatedb
命令创建数据库表,创建成功后,如下
运行后端程序:
npm run dev
运行成功如下:
访问 http://localhost:3000/api-docs
查看服务是否正常启动,如下:
可以点击用户模块的用户注册创建一个用户:
成功后如下:
也可以尝试登录:
成功后如下:
这样我们的后端程序就部署完成了。
运行前端:
克隆前端代码:
sh
git clone https://github.com/DuRuofu/Vue-Element-Admin-Templates
下载依赖:
npm i
运行项目:
npm run dev
如下:
输入刚才注册的账户进行登录,如下: