move initmime from beego.Run to hookfunc

This commit is contained in:
astaxie 2013-12-31 00:34:47 +08:00
parent eea272482b
commit 383a04f4c2
2 changed files with 4 additions and 4 deletions

View File

@ -18,6 +18,8 @@ var hooks []hookfunc //hook function slice to store the hookfunc
func init() {
hooks = make([]hookfunc, 0)
//init mime
AddAPPStartHook(initMime)
}
// Router adds a patterned controller handler to BeeApp.
@ -112,9 +114,6 @@ func Run() {
}
}
//init mime
initMime()
// do hooks function
for _, hk := range hooks {
err := hk()

View File

@ -544,8 +544,9 @@ var mimemaps map[string]string = map[string]string{
".mustache": "text/html",
}
func initMime() {
func initMime() error {
for k, v := range mimemaps {
mime.AddExtensionType(k, v)
}
return nil
}