Skip to content

Commit

Permalink
trans:improve describe and update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
axfor committed May 10, 2019
1 parent 922a727 commit 96bf6ee
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 176 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ bast.Run(":9999")

# config template

` support multiple instances`
` support multiple instances`


``` json
[
Expand All @@ -202,6 +203,9 @@ bast.Run(":9999")
"log":{
"outPath":"./logs/logs.log", //(default is ./logs/logs.log)
"level":"debug",
"maxSize":10,
"maxBackups":3,
"maxAge":28,
"debug":false
},
"conf":{//user config(non bast framework)
Expand Down
13 changes: 10 additions & 3 deletions bast.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,25 @@ func (app *App) ListenAndServe() error {
return app.Server.ListenAndServe()
}

// Get registers the handler function for the given pattern
// in the DefaultServeMux.
// The documentation for ServeMux explains how patterns are matched.
func Get(pattern string, f func(ctx *Context), authorization ...bool) {
doHandle("GET", pattern, f, authorization...)
}

// Post registers the handler function for the given pattern
// in the DefaultServeMux.
// The documentation for ServeMux explains how patterns are matched.
func Post(pattern string, f func(ctx *Context), authorization ...bool) {
doHandle("POST", pattern, f, authorization...)
}

// Get registers the handler function for the given pattern
// Put registers the handler function for the given pattern
// in the DefaultServeMux.
// The documentation for ServeMux explains how patterns are matched.
func Get(pattern string, f func(ctx *Context), authorization ...bool) {
doHandle("GET", pattern, f, authorization...)
func Put(pattern string, f func(ctx *Context), authorization ...bool) {
doHandle("PUT", pattern, f, authorization...)
}

// FileServer registers the handler function for the given pattern
Expand Down
3 changes: 2 additions & 1 deletion config.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[
{
{//a instance
"key":"conf",
"name":"xxx",
"addr":":8888",
Expand All @@ -27,4 +27,5 @@
"dbServer":"localhost"
}
}
//..more instances..//
]
Loading

0 comments on commit 96bf6ee

Please sign in to comment.