MCPcopy Index your code
hub / github.com/DoNewsCode/core / Example_modules

Function Example_modules

srvhttp/example_test.go:16–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14)
15
16func Example_modules() {
17 c := core.New()
18 defer c.Shutdown()
19
20 c.AddModule(srvhttp.DocsModule{})
21 c.AddModule(srvhttp.HealthCheckModule{})
22 c.AddModule(srvhttp.MetricsModule{})
23 c.AddModule(srvhttp.DebugModule{})
24
25 router := mux.NewRouter()
26 modules := c.Modules()
27 for i := range modules {
28 if m, ok := modules[i].(core.HTTPProvider); ok {
29 m.ProvideHTTP(router)
30 }
31 }
32 http.ListenAndServe(":8080", router)
33}
34
35func ExampleResponseEncoder_EncodeResponse() {
36 handler := func(writer http.ResponseWriter, request *http.Request) {

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
ShutdownMethod · 0.80
ModulesMethod · 0.65
ProvideHTTPMethod · 0.65
AddModuleMethod · 0.45

Tested by

no test coverage detected