mirror of https://github.com/ouqiang/gocron
静态文件和API使用相对路径
parent
370645fca8
commit
ea18109b92
|
@ -74,7 +74,7 @@ docker run --name gocron -p 5920:5920 -d ouqg/gocron
|
||||||
1. 安装Go1.9+, Node.js, Yarn
|
1. 安装Go1.9+, Node.js, Yarn
|
||||||
2. 安装前端依赖 `make install-vue`
|
2. 安装前端依赖 `make install-vue`
|
||||||
3. 启动gocron, gocron-node `make run`
|
3. 启动gocron, gocron-node `make run`
|
||||||
4. 启动node server `cd web/vue && yarn run dev`, 访问地址 http://localhost:8080
|
4. 启动node server `make run-vue`, 访问地址 http://localhost:8080
|
||||||
|
|
||||||
访问http://localhost:8080, API请求会转发给gocron
|
访问http://localhost:8080, API请求会转发给gocron
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-macaron/binding"
|
||||||
"github.com/go-sql-driver/mysql"
|
"github.com/go-sql-driver/mysql"
|
||||||
"github.com/lib/pq"
|
"github.com/lib/pq"
|
||||||
"github.com/go-macaron/binding"
|
|
||||||
"github.com/ouqiang/gocron/internal/models"
|
"github.com/ouqiang/gocron/internal/models"
|
||||||
"github.com/ouqiang/gocron/internal/modules/app"
|
"github.com/ouqiang/gocron/internal/modules/app"
|
||||||
"github.com/ouqiang/gocron/internal/modules/setting"
|
"github.com/ouqiang/gocron/internal/modules/setting"
|
||||||
|
@ -150,21 +150,19 @@ func testDbConnection(form InstallForm) error {
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
err = db.Ping()
|
err = db.Ping()
|
||||||
if s.Db.Engine == "postgres" && err != nil {
|
if s.Db.Engine == "postgres" && err != nil {
|
||||||
msg := "数据库连接失败"
|
pgError, ok := err.(*pq.Error)
|
||||||
pgError, _ := err.(*pq.Error)
|
if ok && pgError.Code == "3D000" {
|
||||||
if pgError.Code == "3D000" {
|
err = errors.New("数据库不存在")
|
||||||
msg = "数据库不存在"
|
}
|
||||||
}
|
return err
|
||||||
return errors.New(msg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Db.Engine == "mysql" && err != nil {
|
if s.Db.Engine == "mysql" && err != nil {
|
||||||
msg := "数据库连接失败"
|
mysqlError, ok := err.(*mysql.MySQLError)
|
||||||
mysqlError, _ := err.(*mysql.MySQLError)
|
if ok && mysqlError.Number == 1049 {
|
||||||
if mysqlError.Number == 1049 {
|
err = errors.New("数据库不存在")
|
||||||
msg = "数据库不存在"
|
|
||||||
}
|
}
|
||||||
return errors.New(msg)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
|
File diff suppressed because one or more lines are too long
4
makefile
4
makefile
|
@ -52,6 +52,10 @@ build-vue:
|
||||||
install-vue:
|
install-vue:
|
||||||
cd web/vue && yarn install
|
cd web/vue && yarn install
|
||||||
|
|
||||||
|
.PHONY: run-vue
|
||||||
|
run-vue:
|
||||||
|
cd web/vue && yarn run dev
|
||||||
|
|
||||||
.PHONY: statik
|
.PHONY: statik
|
||||||
statik:
|
statik:
|
||||||
go get github.com/rakyll/statik
|
go get github.com/rakyll/statik
|
||||||
|
|
|
@ -58,7 +58,7 @@ module.exports = {
|
||||||
// Paths
|
// Paths
|
||||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||||
assetsSubDirectory: 'static',
|
assetsSubDirectory: 'static',
|
||||||
assetsPublicPath: '/public/',
|
assetsPublicPath: 'public/',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source Maps
|
* Source Maps
|
||||||
|
|
|
@ -12,7 +12,7 @@ const AUTH_ERROR_CODE = 401
|
||||||
// 应用未安装
|
// 应用未安装
|
||||||
const APP_NOT_INSTALL_CODE = 801
|
const APP_NOT_INSTALL_CODE = 801
|
||||||
|
|
||||||
axios.defaults.baseURL = '/api'
|
axios.defaults.baseURL = 'api'
|
||||||
axios.defaults.timeout = 10000
|
axios.defaults.timeout = 10000
|
||||||
axios.defaults.responseType = 'json'
|
axios.defaults.responseType = 'json'
|
||||||
axios.interceptors.request.use(config => {
|
axios.interceptors.request.use(config => {
|
||||||
|
|
Loading…
Reference in New Issue