Lunny Xiao edited this page Jan 13, 2015 · 4 revisions

Static lets you make an one line web server.

func main() {
    t := tango.New(tango.Static())
    t.Run()
}

Then, put your files on ./public folder. You can visit them directly. For example:

http://localhost/images/logo.png  --> ./public/images/logo.png

Of course, you can add yourself handler to specify the process.

func main() {
    t := tango.New()
    t.Use(AuthHandler)
    t.Use(tango.Static())
    t.Run()
}

Of course, you can use StaticOptions to custom your static, for example:

t.Use(tango.Static(tango.StaticOptions{Prefix:"static"}))
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.