Iris Web Framework Introduction

Iris Web Framework Introduction

Iris web framework is a good framework among all other Go based frameworks available at this time. It can run on cloud like AWS, Google Cloud, and Azure too.

A book is available for better understanding of this framework and good thing is this book written by creator of this framework.

Iris CLI

Iris CLI is smart enough to separate and understand backend and frontend changes, it rebuilds your javascript packages and sends a refresh signal to the browser.

CLI provides number of ready made templates using React, Typescript, Svelte, Bootstrap, Admin Panel etc.

Let's create simple server using this framework

Installation

mkdir sample-app
cd sample-app
go mod init sample-app
go get github.com/kataras/iris/v12@master

Now create a new file inside `sample-app` directory called main.go

package main

import "github.com/kataras/iris/v12"

func main() {
	app := iris.New()
	app.Get("/", func(ctx iris.Context) {
		ctx.WriteString("Working sample!")
	})
	app.Listen(":3000")

}

Run project using following command

go run main.go

Now open browser and hit http://localhost:3000 you would see following screen as output.

Sample output of running project

Source code for this tutorial https://github.com/santoshanand/sample-app

Happy coding!