Last active
April 13, 2016 19:42
-
-
Save jamesharr/9468062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"github.com/astaxie/beego" | |
"io/ioutil" | |
) | |
type MainController struct { | |
beego.Controller | |
} | |
func (this *MainController) Get() { | |
// Cheap little hack to get index.html to display for "/" | |
content, err := ioutil.ReadFile("static/index.html") | |
if err != nil { | |
panic(err) | |
} | |
this.Ctx.Output.Header("Content-Type", "text/html; charset=utf-8") | |
this.Ctx.Output.Body(content) | |
this.RenderBytes() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"FrontEnd/controllers" | |
"github.com/astaxie/beego" | |
) | |
func main() { | |
beego.Router("/", &controllers.MainController{}) | |
for _, path := range []string{"css","js","img"} { | |
beego.SetStaticPath("/"+path, "static/"+path) | |
} | |
beego.Run() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment