Skip to content

后端接口使用说明 #4

Description

@go-laoji

1、先去https://github.com/go-laoji/3d-datacenter/releases/tag/api-latest 下载对应系统版本的程序
2、init_data 为数据库初始化、模拟数据写入程序;backend 为后端接口程序
3、在目录中创建一个 config.yml 文件内容如下:

server:
  http:
    addr: 0.0.0.0:8008 #http 服务监听 IP 及端口号
    timeout: 30s
  grpc:
    addr: 0.0.0.0:9000 #grpc 服务监听 IP 及端口号
    timeout: 30s
data:
  database:
    driver: sqlite
    source: ./data/idc.db

4、初始化数据库 init_data-{xxx}-{xxx} -conf config.yml 请替换 xxx 为指定的系统和 cpu 架构
5、启动后端服务 backend-{xxx}-{xxx} -conf config.yml 请替换 xxx 为指定的系统和 cpu 架构
6、前端代码支行yarn dev则会自动代理到 8008 的后端服务,默认帐号和密码为 admin/admin

注意:
1、linux 和 macos 需要给程序添加可执行权限 chmod +x init_data-{xxx}-{xxx} backend-{xxx}-{xxx}
2、macos 下可能会提示软件有风险,需要在 隐私与安全性允许软件支行
3、后端使用 gorm 连接数据库,不过开放的服务只支持 sqlite 数据库,修改数据库配置为其它数据源不可运行

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions