Skip to content

Instalasi

Pastikan kamu sudah menginstall:

Cek versi Go:

Terminal window
go version

Download starter dari GitHub Releases.

Atau clone langsung:

Terminal window
git clone https://github.com/semutdev/goigniter
cd goigniter/starter
Terminal window
go mod tidy
Terminal window
go run main.go

Buka http://localhost:8080 - Welcome to GoIgniter!

myapp/
├── application/
│ ├── controllers/ # Controller kamu
│ └── views/ # Template HTML
├── public/ # Static files (CSS, JS, images)
├── go.mod
└── main.go # Entry point

Jika kamu familiar dengan CI3:

CodeIgniter 3GoIgniter
application/controllers/application/controllers/
application/views/application/views/
index.phpmain.go

Edit main.go untuk menambah route baru:

app.GET("/hello", func(c *core.Context) error {
return c.JSON(200, core.Map{
"message": "Hello World!",
})
})

Restart server dan buka http://localhost:8080/hello

Untuk auto-restart saat file berubah, gunakan Air:

Terminal window
go install github.com/cosmtrek/air@latest
air

Lanjut ke Routing untuk belajar cara mendefinisikan routes.