|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func main() { |
|
|
func main() { |
|
|
rex.Get("/", func(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
|
|
|
app := rex.New() |
|
|
|
|
|
app.Get("/", func(w http.ResponseWriter, r *http.Request) { |
|
|
io.WriteString(w, "Hello World") |
|
|
io.WriteString(w, "Hello World") |
|
|
}) |
|
|
}) |
|
|
rex.Run() |
|
|
|
|
|
|
|
|
app.Run() |
|
|
} |
|
|
} |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"io" |
|
|
"io" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/goanywhere/env" |
|
|
"github.com/goanywhere/rex" |
|
|
"github.com/goanywhere/rex" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func main() { |
|
|
func main() { |
|
|
// Override default 5000 port here. |
|
|
// Override default 5000 port here. |
|
|
rex.Env.Set("PORT", 9394) |
|
|
|
|
|
rex.Get("/", index) |
|
|
|
|
|
rex.Run() |
|
|
|
|
|
|
|
|
env.Set("PORT", 9394) |
|
|
|
|
|
|
|
|
|
|
|
app := rex.New() |
|
|
|
|
|
app.Get("/", index) |
|
|
|
|
|
app.Run() |
|
|
} |
|
|
} |
|
|
``` |
|
|
``` |
|
|
|
|
|
|