Examples
This repository provides easy to understand code snippets on how to get started with web development with the Go programming language using the Iris web framework. This branch contains the latest iris master examples. For the stable's version examples navigate through the v12 branch.
To read the Iris documentation please navigate to the wiki pages instead.
Examples are tested using Windows 11, Ubuntu 22.04 LTS, macOS 12 Monterey with Microsoft's Visual Studio Code and built using the Go 1.19.3.
Table of Contents
- Serverless
- REST API for Apache Kafka
- URL Shortener
- Dropzone.js
- Caddy
- Bootstrapper
- Project Structure
π₯ - Monitor
- Database
- HTTP Server
- HOST:PORT
- Public Test Domain
- UNIX socket file
- TLS
- Letsencrypt (Automatic Certifications)
- Socket Sharding (SO_REUSEPORT)
- Graceful Shutdown
- Notify on shutdown
- Custom TCP Listener
- Custom HTTP Server
- Timeout
- HTTP Client
- Configuration
- Routing
- Party Controller NEW
- Overview
- Basic
- Custom HTTP Errors
- HTTP Wire Errors NEW
- Not Found - Intelligence
- Dynamic Path
- Middleware
- Per Route
- Globally
- Remove a Handler
- Share Values
- Handlers Execution Rule
- Route Register Rule
- Convert net/http Handlers
- Rewrite Middleware
- Route State
- Remove Route
- Reverse Routing
- Router Wrapper
- Custom Router
- Subdomains
- HTTP Method Override
- API Versioning
- Sitemap
- Logging
- API Documentation
- Testing
- Recovery
- Profiling
- File Server
- File Server
- HTTP/2 Push Targets
- HTTP/2 Push Targets (Embedded)
- HTTP/2 Push Targets (Gzipped Embedded)
- Favicon
- Basic
- Embedding Files Into App Executable File
- Embedding Files Into App Executable File (Bindata)
- Embedding Gzipped Files Into App Executable File (Bindata)
- Send Files (rate limiter included)
- Single Page Applications
- Upload File
- Upload Multiple Files
- WebDAV
- View
- Overview
- Layout
- Basic
- A simple Layout
- Layouts:
yield
andrender
tmpl funcs - The
urlpath
template func - The
url
template func - Inject Data Between Handlers
- Inject Engine Between Handlers
- Embedding Templates Into App Executable File
- Embedding Templates Into App Executable File (Bindata)
- Write to a custom
io.Writer
- Parse a Template from Text
- Blocks
- Blocks Embedded
- Pug:
Actions
- Pug:
Includes
- Pug Embedded`
- Ace
- Django
- Amber
- Amber Embedded
- Jet
- Jet Embedded
- Jet 'urlpath' tmpl func
- Jet Template Funcs from Struct
- Handlebars
- Third-Parties
- Request ID
- Request Rate Limit
- Request Referrer
- Webassembly
- Request Body
- Response Writer
- Compression
- Localization and Internationalization
- Authentication, Authorization & Bot Detection
- Recommended: Auth package and Single-Sign-On NEW (GO 1.18 Generics required)
- Basic Authentication
- CORS
- JSON Web Tokens
- JWT (community edition)
- OAUth2
- Manage Permissions
- Google reCAPTCHA
- hCaptcha
- Cookies
- Sessions
- Websocket
- Dependency Injection
- MVC
- Overview
- Repository and Service layers
- Hello world
- Basic
- Default request values
- Singleton
- Regexp
- Session Controller
- Authenticated Controller
- Versioned Controller
- Websocket Controller
- Websocket + Authentication (Single-Sign-On) NEW (GO 1.18 Generics required)
- Register Middleware
- gRPC
- gRPC Bidirectional Stream
- Login (Repository and Service layers)
- Login (Single Responsibility)
- Vue.js Todo App
- HTTP Error Handler
- Error Handler
- Handle errors using mvc.Result
- Handle errors using PreflightResult
- Handle errors by hijacking the result
- Desktop Applications
- Middlewares (Community)
Run
- Install the Go Programming Language, version 1.18+ from here.
- Download the examples and copy-paste them to your
$GOPATH/src/github.com/iris-contrib/examples
- Install Iris with
go get -u github.com/kataras/iris/[email protected]
To run an example, open a terminal session and execute:
$ cd $GOPATH/src/github.com/iris-contrib/examples/compression
$ go mod init
$ go run main.go
Do not forget to star or watch the Iris project.
Any troubles with examples?
https://github.com/iris-contrib/examples/issues