File tree Expand file tree Collapse file tree 6 files changed +39
-1
lines changed
Expand file tree Collapse file tree 6 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1515<div align =" center " >
1616 <!-- Release -->
1717 <a href =" https://github.com/kataras/muxie/releases " >
18- <img src="https://img.shields.io/badge/release%20-v1.0.5 -0077b3.svg?style=flat-squaree"
18+ <img src="https://img.shields.io/badge/release%20-v1.0.6 -0077b3.svg?style=flat-squaree"
1919 alt="Release/stability" />
2020 </a >
2121 <!-- Godocs -->
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "log"
5+ "net/http"
6+
7+ "github.com/kataras/muxie"
8+ )
9+
10+ func main () {
11+ mux := muxie .NewMux ()
12+ mux .Handle ("/static/*file" , http .StripPrefix ("/static/" , http .FileServer (http .Dir ("./static" ))))
13+
14+ log .Println ("Server started at http://localhost:8080\n GET: http://localhost:8080/static/\n GET: http://localhost:8080/static/js/empty.js" )
15+ http .ListenAndServe (":8080" , mux )
16+ }
Original file line number Diff line number Diff line change 1+ body {
2+ background-color : black;
3+ }
4+
5+ h1 {
6+ color : white;
7+ }
Original file line number Diff line number Diff line change 1+ < html > < head > < link rel ="stylesheet " href ="./css/main.css "> < title > Index</ title > </ head >
2+ < body >
3+ < h1 > Hello index</ h1 >
4+ </ body >
5+ </ html >
Original file line number Diff line number Diff line change 1+ /* empty js file */
Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ type SubMux interface {
211211 Use (middlewares ... Wrapper )
212212 Handle (pattern string , handler http.Handler )
213213 HandleFunc (pattern string , handlerFunc func (http.ResponseWriter , * http.Request ))
214+ AbsPath () string
214215}
215216
216217// Of returns a new Mux which its Handle and HandleFunc will register the path based on given "prefix", i.e:
@@ -249,6 +250,14 @@ func (m *Mux) Of(prefix string) SubMux {
249250 }
250251}
251252
253+ // AbsPath returns the absolute path of the router for this Mux group.
254+ func (m * Mux ) AbsPath () string {
255+ if m .root == "" {
256+ return "/"
257+ }
258+ return m .root
259+ }
260+
252261/* Notes:
253262
254263Four options to solve optionally "inherition" of parent's middlewares but dismissed:
You can’t perform that action at this time.
0 commit comments