From 4013577c539b1fdc137afa9b50ccd94d4f0ee7c1 Mon Sep 17 00:00:00 2001 From: kataras Date: Mon, 5 Jun 2017 01:01:58 +0300 Subject: [PATCH] add a hello-world example as we had before, we have overview too but it's a little larger and newcomers may afraid :+1: Former-commit-id: 459d70bb690844176177050e37c24e28587f343b --- _examples/README.md | 1 + _examples/beginner/hello-world/main.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 _examples/beginner/hello-world/main.go diff --git a/_examples/README.md b/_examples/README.md index 6aca38bd..ffc3721b 100644 --- a/_examples/README.md +++ b/_examples/README.md @@ -7,6 +7,7 @@ It doesn't contains "best ways" neither explains all its features. It's just a s ## Table of contents * [Level: Beginner](beginner) + * [Hello world](beginner/hello-world/main.go) * [Overview](beginner/overview/main.go) * [Listening](beginner/listening) * [Common, with address](beginner/listening/listen-addr/main.go) diff --git a/_examples/beginner/hello-world/main.go b/_examples/beginner/hello-world/main.go new file mode 100644 index 00000000..f2e95ed0 --- /dev/null +++ b/_examples/beginner/hello-world/main.go @@ -0,0 +1,14 @@ +package main + +import ( + "github.com/kataras/iris" + "github.com/kataras/iris/context" +) + +func main() { + app := iris.New() + app.Handle("GET", "/", func(ctx context.Context) { + ctx.HTML(" Hello world! ") + }) + app.Run(iris.Addr(":8080")) +}