mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:10:54 +00:00
move initmime from beego.Run to hookfunc
This commit is contained in:
parent
eea272482b
commit
383a04f4c2
5
beego.go
5
beego.go
@ -18,6 +18,8 @@ var hooks []hookfunc //hook function slice to store the hookfunc
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
hooks = make([]hookfunc, 0)
|
hooks = make([]hookfunc, 0)
|
||||||
|
//init mime
|
||||||
|
AddAPPStartHook(initMime)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Router adds a patterned controller handler to BeeApp.
|
// Router adds a patterned controller handler to BeeApp.
|
||||||
@ -112,9 +114,6 @@ func Run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//init mime
|
|
||||||
initMime()
|
|
||||||
|
|
||||||
// do hooks function
|
// do hooks function
|
||||||
for _, hk := range hooks {
|
for _, hk := range hooks {
|
||||||
err := hk()
|
err := hk()
|
||||||
|
3
mime.go
3
mime.go
@ -544,8 +544,9 @@ var mimemaps map[string]string = map[string]string{
|
|||||||
".mustache": "text/html",
|
".mustache": "text/html",
|
||||||
}
|
}
|
||||||
|
|
||||||
func initMime() {
|
func initMime() error {
|
||||||
for k, v := range mimemaps {
|
for k, v := range mimemaps {
|
||||||
mime.AddExtensionType(k, v)
|
mime.AddExtensionType(k, v)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user