evio/benchmarks/iris-server/main.go

32 lines
592 B
Go
Raw Normal View History

2017-11-03 04:31:36 +03:00
// Copyright 2017 Joshua J Baker. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package main
import (
"flag"
"fmt"
"log"
"github.com/kataras/iris"
)
var res string
func main() {
var port int
flag.IntVar(&port, "port", 8080, "server port")
flag.Parse()
go log.Printf("http server started on port %d", port)
app := iris.New()
app.Get("/", func(ctx iris.Context) {
ctx.WriteString("Hello World!\r\n")
})
err := app.Run(iris.Addr(fmt.Sprintf(":%d", port)))
if err != nil {
log.Fatal(err)
}
}