Want to serve static from static.domain.io without nginx or apache? You wanna separate backend api on api.domain.io? Just do it with this library!
It works like simple middleware, so you can inject it in your app incredibly fast.
With a properly configured Go toolchain:
go get github.com/furdarius/subswitch// .. router init ..
// Let's serve static from domain.io
// and REST api from api.domain.io
ss := subswitch.New(http.FileServer(http.Dir("/tmp")), map[string]http.Handler{
"api": router,
})
// Use it like http.Handler
http.ListenAndServe(":8080", ss)