Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix_add_apppath'
Browse files Browse the repository at this point in the history
  • Loading branch information
kfrico committed Jul 18, 2023
2 parents 1e9f568 + 75dc354 commit d301f14
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 37 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ docker pull ipushc/cassandra-web
* CASSANDRA_PORT: 9042
* CASSANDRA_USERNAME: username
* CASSANDRA_PASSWORD: password
* APP_PATH: path

---

Expand Down
35 changes: 18 additions & 17 deletions client/src/api/config.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,68 @@
export const domain = window.location.origin;
// export const domain = 'http://localhost:8083'
export const domain = "";
// export const domain = window.location.origin+"/";
// export const domain = 'http://localhost:8083/'

const config = {
root: {
find: {
type: 'POST',
url: `${domain}/find`
url: `${domain}find`
},
query: {
type: 'POST',
url: `${domain}/query`
url: `${domain}query`
},
save: {
type: 'POST',
url: `${domain}/save`
url: `${domain}save`
},
delete: {
type: 'POST',
url: `${domain}/delete`
url: `${domain}delete`
},
import: {
type: 'POST',
url: `${domain}/import`
url: `${domain}import`
},
rowtoken: {
type: 'POST',
url: `${domain}/rowtoken`
url: `${domain}rowtoken`
},
truncate: {
type: 'POST',
url: `${domain}/truncate`
url: `${domain}truncate`
},
keyspace: {
type: 'GET',
url: `${domain}/keyspace`
url: `${domain}keyspace`
},
table: {
type: 'GET',
url: `${domain}/table`
url: `${domain}table`
},
row: {
type: 'GET',
url: `${domain}/row`
url: `${domain}row`
},
columns: {
type: 'GET',
url: `${domain}/columns`
url: `${domain}columns`
},
describe: {
type: 'GET',
url: `${domain}/describe`
url: `${domain}describe`
},
export: {
type: 'GET',
url: `${domain}/export`
url: `${domain}export`
},
hostinfo: {
type: 'GET',
url: `${domain}/hostinfo`
url: `${domain}hostinfo`
},
readonly: {
type: 'GET',
url: `${domain}/readonly`
url: `${domain}readonly`
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions client/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ module.exports = {
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
},

publicPath: '.'
}
2 changes: 2 additions & 0 deletions service/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ CASSANDRA_HOST: cassandra
CASSANDRA_PORT: 9042
CASSANDRA_USERNAME:
CASSANDRA_PASSWORD:

APP_PATH:
41 changes: 21 additions & 20 deletions service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"unsafe"

"github.com/gocql/gocql"
"github.com/json-iterator/go"
jsoniter "github.com/json-iterator/go"
"github.com/labstack/echo"
// "github.com/labstack/echo/middleware"
"github.com/labstack/gommon/log"
Expand Down Expand Up @@ -73,6 +73,7 @@ type envStruct struct {
CassandraPort int `mapstructure:"CASSANDRA_PORT" json:"CASSANDRA_PORT"`
CassandraUsername string `mapstructure:"CASSANDRA_USERNAME" json:"CASSANDRA_USERNAME"`
CassandraPassword string `mapstructure:"CASSANDRA_PASSWORD" json:"CASSANDRA_PASSWORD"`
AppPath string `mapstructure:"APP_PATH" json:"APP_PATH"`
}

func main() {
Expand Down Expand Up @@ -161,25 +162,25 @@ func run(c *cli.Context) {
// }))

// 讀靜態檔(前端)
e.Static("/static", "client/dist/static")
e.File("/", "client/dist/index.html")

e.POST("/query", h.Query)
e.POST("/save", h.Save)
e.POST("/delete", h.Delete)
e.POST("/find", h.Find)
e.POST("/import", h.Import)
e.POST("/rowtoken", h.RowToken)
e.POST("/truncate", h.Truncate)

e.GET("/keyspace", h.KeySpace)
e.GET("/table", h.Table)
e.GET("/row", h.Row)
e.GET("/describe", h.Describe)
e.GET("/columns", h.Columns)
e.GET("/export", h.Export)
e.GET("/hostinfo", h.HostInfo)
e.GET("/readonly", h.ReadOnlyInfo)
e.Static(env.AppPath+"/static", "client/dist/static")
e.File(env.AppPath+"/", "client/dist/index.html")

e.POST(env.AppPath+"/query", h.Query)
e.POST(env.AppPath+"/save", h.Save)
e.POST(env.AppPath+"/delete", h.Delete)
e.POST(env.AppPath+"/find", h.Find)
e.POST(env.AppPath+"/import", h.Import)
e.POST(env.AppPath+"/rowtoken", h.RowToken)
e.POST(env.AppPath+"/truncate", h.Truncate)

e.GET(env.AppPath+"/keyspace", h.KeySpace)
e.GET(env.AppPath+"/table", h.Table)
e.GET(env.AppPath+"/row", h.Row)
e.GET(env.AppPath+"/describe", h.Describe)
e.GET(env.AppPath+"/columns", h.Columns)
e.GET(env.AppPath+"/export", h.Export)
e.GET(env.AppPath+"/hostinfo", h.HostInfo)
e.GET(env.AppPath+"/readonly", h.ReadOnlyInfo)

// Start server
e.Logger.Fatal(e.Start(env.HostPort))
Expand Down

0 comments on commit d301f14

Please sign in to comment.