MCPcopy Create free account
hub / github.com/kataras/iris / main

Function main

_examples/http-server/custom-httpserver/easy-way/main.go:9–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7)
8
9func main() {
10 app := iris.New()
11
12 app.Get("/", func(ctx iris.Context) {
13 ctx.Writef("Hello from the server")
14 })
15
16 app.Get("/mypath", func(ctx iris.Context) {
17 ctx.Writef("Hello from %s", ctx.Path())
18 })
19
20 // Any custom fields here. Handler and ErrorLog are set to the server automatically
21 srv := &http.Server{Addr: ":8080"}
22
23 // http://localhost:8080/
24 // http://localhost:8080/mypath
25 app.Run(iris.Server(srv)) // same as app.Listen(":8080")
26
27 // More:
28 // see "multi" if you need to use more than one server at the same app.
29 //
30 // for a custom listener use: iris.Listener(net.Listener) or
31 // iris.TLS(cert,key) or iris.AutoTLS(), see "custom-listener" example for those.
32}

Callers

nothing calls this directly

Calls 5

NewMethod · 0.80
WritefMethod · 0.80
GetMethod · 0.65
PathMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…