Ejemplo n.º 1
0
Archivo: router.go Proyecto: GeoNet/haz
func init() {
	indexTemp = template.Must(template.ParseFiles("assets/tmpl/index.html"))
	http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets"))))

	serveMux = http.NewServeMux()
	serveMux.HandleFunc("/geojson", weft.MakeHandlerAPI(getQuakesGeoJson))
	serveMux.HandleFunc("/count", weft.MakeHandlerAPI(getQuakesCount))
	serveMux.HandleFunc("/csv", weft.MakeHandlerAPI(getQuakesCsv))
	serveMux.HandleFunc("/gml", weft.MakeHandlerAPI(getQuakesGml))
	serveMux.HandleFunc("/kml", weft.MakeHandlerAPI(getQuakesKml))
	serveMux.HandleFunc("/", weft.MakeHandlerPage(indexPage))

	// routes for balancers and probes.
	serveMux.HandleFunc("/soh/up", http.HandlerFunc(up))
	serveMux.HandleFunc("/soh", http.HandlerFunc(soh))
}
Ejemplo n.º 2
0
Archivo: server.go Proyecto: GeoNet/mtr
func init() {
	mux.HandleFunc("/", weft.MakeHandlerAPI(home))
	mux.HandleFunc("/health", health)

	// routes for balancers and probes.
	mux.HandleFunc("/soh/up", http.HandlerFunc(up))
	mux.HandleFunc("/soh", http.HandlerFunc(soh))
}
Ejemplo n.º 3
0
Archivo: router.go Proyecto: GeoNet/haz
func init() {
	indexTemp = template.Must(template.ParseFiles("assets/tmpl/index.html"))
	http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets"))))

	/**
	  Request example:
	  1. ows
	   http://wfs.geonet.org.nz/geonet/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=geonet:quake_search_v1
	    &outputFormat=json&cql_filter=origintime>='2013-06-01'+AND+origintime<'2014-01-01'+AND+usedphasecount>60

	  2. wms
	   http://wfs.geonet.org.nz/geonet/wms/kml?layers=geonet:quake_search_v1&maxFeatures=50
	*/
	serveMux = http.NewServeMux()
	serveMux.HandleFunc("/geonet/wms/kml", weft.MakeHandlerAPI(getQuakesKml))
	serveMux.HandleFunc("/geonet/ows", weft.MakeHandlerAPI(getQuakesWfs))
	serveMux.HandleFunc("/", weft.MakeHandlerPage(indexPage))

	// routes for balancers and probes.
	serveMux.HandleFunc("/soh/up", http.HandlerFunc(up))
	serveMux.HandleFunc("/soh", http.HandlerFunc(soh))
}
Ejemplo n.º 4
0
func init() {
	muxV1GeoJSON = http.NewServeMux()
	muxV1GeoJSON.HandleFunc("/quake", weft.MakeHandlerAPI(quakesRegionV1))
	muxV1GeoJSON.HandleFunc("/quake/", weft.MakeHandlerAPI(quakeV1))
	muxV1GeoJSON.HandleFunc("/intensity", weft.MakeHandlerAPI(intensityMeasuredLatestV1))
	muxV1GeoJSON.HandleFunc("/felt/report", weft.MakeHandlerAPI(feltV1))

	muxV1JSON = http.NewServeMux()
	muxV1JSON.HandleFunc("/news/geonet", weft.MakeHandlerAPI(newsV1))

	muxV2GeoJSON = http.NewServeMux()
	muxV2GeoJSON.HandleFunc("/intensity", weft.MakeHandlerAPI(intensityV2))
	muxV2GeoJSON.HandleFunc("/quake", weft.MakeHandlerAPI(quakesV2))
	muxV2GeoJSON.HandleFunc("/quake/", weft.MakeHandlerAPI(quakeV2))
	muxV2GeoJSON.HandleFunc("/quake/history/", weft.MakeHandlerAPI(quakeHistoryV2))
	muxV2GeoJSON.HandleFunc("/volcano/val", weft.MakeHandlerAPI(valV2))

	muxV2JSON = http.NewServeMux()
	muxV2JSON.HandleFunc("/news/geonet", weft.MakeHandlerAPI(newsV2))
	muxV2JSON.HandleFunc("/quake/stats", weft.MakeHandlerAPI(quakeStatsV2))

	// protobufs
	muxProto = http.NewServeMux()
	muxProto.HandleFunc("/quake", weft.MakeHandlerAPI(quakesProto))
	muxProto.HandleFunc("/quake/", weft.MakeHandlerAPI(quakeProto))
	muxProto.HandleFunc("/quake/technical/", weft.MakeHandlerAPI(quakeTechnicalProto))
	muxProto.HandleFunc("/quake/history/", weft.MakeHandlerAPI(quakeHistoryProto))
	muxProto.HandleFunc("/intensity", weft.MakeHandlerAPI(intensityProto))
	muxProto.HandleFunc("/volcano/val", weft.MakeHandlerAPI(valProto))
	muxProto.HandleFunc("/news/geonet", weft.MakeHandlerAPI(newsProto))
	muxProto.HandleFunc("/quake/stats", weft.MakeHandlerAPI(quakeStatsProto))

	// muxDefault handles routes with no Accept version.
	// soh routes
	muxDefault = http.NewServeMux()
	muxDefault.HandleFunc("/soh", http.HandlerFunc(soh))
	muxDefault.HandleFunc("/soh/esb", http.HandlerFunc(sohEsb))
	muxDefault.HandleFunc("/soh/up", http.HandlerFunc(up))
	muxDefault.HandleFunc("/soh/impact", http.HandlerFunc(impactSOH))

	muxDefault.HandleFunc("/cap/1.2/GPA1.0/quake/", weft.MakeHandlerAPI(capQuake))
	muxDefault.HandleFunc("/cap/1.2/GPA1.0/feed/atom1.0/quake", weft.MakeHandlerAPI(capQuakeFeed))
	// The 'latest' version of the API for unversioned requests.
	muxDefault.HandleFunc("/quake/", weft.MakeHandlerAPI(quakeV2))
	muxDefault.HandleFunc("/quake", weft.MakeHandlerAPI(quakesV2))
	muxDefault.HandleFunc("/quake/history/", weft.MakeHandlerAPI(quakeHistoryV2))
	muxDefault.HandleFunc("/quake/stats", weft.MakeHandlerAPI(quakeStatsV2))
	muxDefault.HandleFunc("/intensity", weft.MakeHandlerAPI(intensityV2))
	muxDefault.HandleFunc("/news/geonet", weft.MakeHandlerAPI(newsV2))
	muxDefault.HandleFunc("/volcano/val", weft.MakeHandlerAPI(valV2))

	for _, v := range []*http.ServeMux{muxV1JSON, muxV2JSON, muxV1GeoJSON, muxV2GeoJSON, muxDefault, muxProto} {
		v.HandleFunc("/", weft.MakeHandlerPage(docs))
	}

}
Ejemplo n.º 5
0
func init() {
	mux.HandleFunc("/api-docs", weft.MakeHandlerPage(docHandler))
	mux.HandleFunc("/app", weft.MakeHandlerAPI(appHandler))
	mux.HandleFunc("/app/metric", weft.MakeHandlerAPI(appmetricHandler))
	mux.HandleFunc("/application/counter", weft.MakeHandlerAPI(applicationcounterHandler))
	mux.HandleFunc("/application/metric", weft.MakeHandlerAPI(applicationmetricHandler))
	mux.HandleFunc("/application/timer", weft.MakeHandlerAPI(applicationtimerHandler))
	mux.HandleFunc("/data/completeness", weft.MakeHandlerAPI(datacompletenessHandler))
	mux.HandleFunc("/data/completeness/summary", weft.MakeHandlerAPI(datacompletenesssummaryHandler))
	mux.HandleFunc("/data/completeness/tag", weft.MakeHandlerAPI(datacompletenesstagHandler))
	mux.HandleFunc("/data/completeness/type", weft.MakeHandlerAPI(datacompletenesstypeHandler))
	mux.HandleFunc("/data/latency", weft.MakeHandlerAPI(datalatencyHandler))
	mux.HandleFunc("/data/latency/summary", weft.MakeHandlerAPI(datalatencysummaryHandler))
	mux.HandleFunc("/data/latency/tag", weft.MakeHandlerAPI(datalatencytagHandler))
	mux.HandleFunc("/data/latency/threshold", weft.MakeHandlerAPI(datalatencythresholdHandler))
	mux.HandleFunc("/data/site", weft.MakeHandlerAPI(datasiteHandler))
	mux.HandleFunc("/data/type", weft.MakeHandlerAPI(datatypeHandler))
	mux.HandleFunc("/field/device", weft.MakeHandlerAPI(fielddeviceHandler))
	mux.HandleFunc("/field/metric", weft.MakeHandlerAPI(fieldmetricHandler))
	mux.HandleFunc("/field/metric/summary", weft.MakeHandlerAPI(fieldmetricsummaryHandler))
	mux.HandleFunc("/field/metric/tag", weft.MakeHandlerAPI(fieldmetrictagHandler))
	mux.HandleFunc("/field/metric/threshold", weft.MakeHandlerAPI(fieldmetricthresholdHandler))
	mux.HandleFunc("/field/model", weft.MakeHandlerAPI(fieldmodelHandler))
	mux.HandleFunc("/field/state", weft.MakeHandlerAPI(fieldstateHandler))
	mux.HandleFunc("/field/state/tag", weft.MakeHandlerAPI(fieldstatetagHandler))
	mux.HandleFunc("/field/type", weft.MakeHandlerAPI(fieldtypeHandler))
	mux.HandleFunc("/tag", weft.MakeHandlerAPI(tagHandler))
	mux.HandleFunc("/tag/", weft.MakeHandlerAPI(tagsHandler))
}
Ejemplo n.º 6
0
func init() {
	mux.HandleFunc("/api-docs", weft.MakeHandlerPage(docHandler))
	mux.HandleFunc("/csv/1.0.0/", weft.MakeHandlerAPI(csv1_0_0sHandler))
	mux.HandleFunc("/quakeml/1.2/", weft.MakeHandlerAPI(quakeml1_2sHandler))
	mux.HandleFunc("/quakeml-rt/1.2/", weft.MakeHandlerAPI(quakeml_rt1_2sHandler))
}