Beispiel #1
0
func router(w http.ResponseWriter, r *http.Request) {
	urlpath := r.URL.Path
	//路由匹配正则 "^/mongo.+"
	if moeregexp.IsMatch(httpmongo.Mongo_path, urlpath) {
		//调用handler_mongo,处理 /mongo路由下的所有请求
		httpmongo.Httphandler_mongo(*mongodb, w, r)
	}
}
Beispiel #2
0
func router(w http.ResponseWriter, r *http.Request) {
	urlpath := r.URL.Path

	if moeregexp.IsMatch(httpmongo.Mongo_path, urlpath) {
		httpmongo.Httphandler_mongo(getmongo(), w, r)
	} else {
		switch urlpath[0:] {
		case "/":
			handle_admin(w, r)
		default:
			w.Write([]byte("404"))
		}
	}
}