2
2
3
3
<a href =" https://iris-go.com " > <img align =" right " width =" 115px " src =" https://iris-go.com/images/icon.svg?v=a " title =" logo created by @merry.dii " /> </a >
4
4
5
- <a href =" https://travis-ci.org /kataras/iris " ><img src =" https://img.shields.io/travis/ kataras/iris.svg ?style=flat-square " alt =" Build Status " ></a >
5
+ <a href =" https://github.com /kataras/iris/actions " ><img src =" https://img.shields.io/github/workflow/status/ kataras/iris/CI/master ?style=flat-square " alt =" Build Status " ></a >
6
6
<a href =" https://github.com/iris-contrib/examples/blob/v12/LICENSE " ><img src =" https://img.shields.io/badge/%20license-MIT%20%20License%20-E91E63.svg?style=flat-square " alt =" License " ></a >
7
7
<a href =" https://github.com/kataras/iris/blob/master/HISTORY.md " ><img src =" https://img.shields.io/badge/version-v12.2.x%20-blue.svg?style=flat-square " alt =" CHANGELOG/HISTORY " ></a >
8
8
9
9
This repository provides easy to understand code snippets on how to get started with web development with the Go programming language using the [ Iris] ( https://github.com/kataras/iris ) web framework. This branch contains the latest [ iris master examples] ( github.com/kataras/iris/tree/master ) . For the stable's version examples navigate through the [ v12 branch] ( https://github.com/iris-contrib/examples/tree/v12 ) .
10
10
11
11
To read the Iris documentation please navigate to [ the wiki pages] ( https://github.com/kataras/iris/wiki ) instead.
12
12
13
- > Examples are tested using Windows 10 , Ubuntu 20 .04 with [ Microsoft's Visual Studio Code] ( https://code.visualstudio.com/ ) and built using the [ Go 1.15.0 ] ( https://golang.org /dl ) .
13
+ > Examples are tested using Windows 11 , Ubuntu 22 .04 LTS, macOS 12 Monterey with [ Microsoft's Visual Studio Code] ( https://code.visualstudio.com/ ) and built using the [ Go 1.19.rc2 ] ( https://go.dev /dl/ ) .
14
14
15
15
# Table of Contents
16
16
@@ -19,13 +19,18 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
19
19
* [ URL Shortener] ( url-shortener )
20
20
* [ Dropzone.js] ( dropzonejs )
21
21
* [ Caddy] ( caddy )
22
+ * [ Bootstrapper] ( bootstrapper )
23
+ * [ Project Structure] ( project ) :fire :
24
+ * Monitor
25
+ * [ Simple Process Monitor (includes UI)] ( monitor/monitor-middleware/main.go ) ** NEW**
26
+ * [ Heap, MSpan/MCache, Size Classes, Objects, Goroutines, GC/CPU fraction (includes UI)] ( monitor/statsviz/main.go ) ** NEW**
22
27
* Database
23
28
* [ MySQL, Groupcache & Docker] ( database/mysql )
24
29
* [ MongoDB] ( database/mongodb )
25
30
* [ Sqlx] ( database/orm/sqlx/main.go )
26
- * [ Xorm] ( database/orm/xorm/main.go )
27
31
* [ Gorm] ( database/orm/gorm/main.go )
28
32
* [ Reform] ( database/orm/reform/main.go )
33
+ * [ x/sqlx] ( database/sqlx/main.go ) ** NEW**
29
34
* HTTP Server
30
35
* [ HOST: PORT ] ( http-server/listen-addr/main.go )
31
36
* [ Public Test Domain] ( http-server/listen-addr-public/main.go )
@@ -42,17 +47,25 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
42
47
* [ Use Iris as a single http.Handler] ( http-server/custom-httpserver/std-way/main.go )
43
48
* [ Multi Instances] ( http-server/custom-httpserver/multi/main.go )
44
49
* [ HTTP/3 Quic] ( http-server/http3-quic )
50
+ * [ H2C] ( http-server/h2c/main.go ) ** NEW**
51
+ * [ Timeout] ( http-server/timeout/main.go )
52
+ * HTTP Client
53
+ * [ Weather Client] ( http-client/weatherapi )
45
54
* Configuration
46
55
* [ Functional] ( configuration/functional/main.go )
47
56
* [ Configuration Struct] ( configuration/from-configuration-structure/main.go )
48
57
* [ Using Viper] ( configuration/viper )
49
58
* [ Import from YAML] ( configuration/from-yaml-file/main.go )
50
59
* [ Share Configuration across instances] ( configuration/from-yaml-file/shared-configuration/main.go )
51
60
* [ Import from TOML] ( configuration/from-toml-file/main.go )
61
+ * [ Multi Environment Configuration] ( configuration/multi-environments ) ** NEW**
52
62
* Routing
63
+ * [ Party Controller] ( routing/party-controller ) ** NEW**
53
64
* [ Overview] ( routing/overview/main.go )
54
65
* [ Basic] ( routing/basic/main.go )
55
66
* [ Custom HTTP Errors] ( routing/http-errors/main.go )
67
+ * [ HTTP Wire Errors] ( routing/http-wire-errors/main.go ) ** NEW**
68
+ * [ Custom Validation Errors] ( routing/http-wire-errors/custom-validation-errors/main.go )
56
69
* [ Not Found - Intelligence] ( routing/intelligence/main.go )
57
70
* [ Not Found - Suggest Closest Paths] ( routing/intelligence/manual/main.go )
58
71
* [ Dynamic Path] ( routing/dynamic-path/main.go )
@@ -62,6 +75,7 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
62
75
* Middleware
63
76
* [ Per Route] ( routing/writing-a-middleware/per-route/main.go )
64
77
* [ Globally] ( routing/writing-a-middleware/globally/main.go )
78
+ * [ Remove a Handler] ( routing/remove-handler/main.go )
65
79
* Share Values
66
80
* [ Share Services] ( routing/writing-a-middleware/share-services/main.go )
67
81
* [ Share Functions] ( routing/writing-a-middleware/share-funcs/main.go )
@@ -70,9 +84,11 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
70
84
* Convert net/http Handlers
71
85
* [ From func(w http.ResponseWriter, r * http.Request, next http.HandlerFunc)] ( convert-handlers/negroni-like/main.go )
72
86
* [ From http.Handler or http.HandlerFunc] ( convert-handlers/nethttp/main.go )
73
- * [ From func(http.HandlerFunc) http.HandlerFunc] ( convert-handlers/real-usecase-raven/writing-middleware/main.go )
87
+ * [ From func(http.Handler) http.Handler] ( convert-handlers/wrapper/main.go )
88
+ * [ Convert by your own: sentry/raven middleware] ( convert-handlers/real-usecase-raven/writing-middleware/main.go )
74
89
* [ Rewrite Middleware] ( routing/rewrite/main.go )
75
90
* [ Route State] ( routing/route-state/main.go )
91
+ * [ Remove Route] ( routing/remove-route/main.go )
76
92
* [ Reverse Routing] ( routing/reverse/main.go )
77
93
* [ Router Wrapper] ( routing/custom-wrapper/main.go )
78
94
* [ Custom Router] ( routing/custom-router/main.go )
@@ -100,11 +116,13 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
100
116
* [ The CSV Formatter] ( logging/request-logger/accesslog-csv/main.go )
101
117
* [ Create your own Formatter] ( logging/request-logger/accesslog-formatter/main.go )
102
118
* [ Root and Proxy AccessLog instances] ( logging/request-logger/accesslog-proxy/main.go )
119
+ * [ Slack integration example] ( logging/request-logger/accesslog-slack/main.go )
103
120
* API Documentation
104
121
* [ Yaag] ( apidoc/yaag/main.go )
105
- * [ Swagger] ( https://github.com/iris-contrib/swagger/tree/master/example )
122
+ * [ Swagger] ( https://github.com/iris-contrib/swagger/tree/master/_examples/basic )
106
123
* [ Testing] ( testing/httptest/main_test.go )
107
124
* [ Recovery] ( recover/main.go )
125
+ * [ Panic and custom Error Handler with Compression] ( recover/panic-and-custom-error-handler-with-compression/main.go )
108
126
* [ Profiling] ( pprof/main.go )
109
127
* File Server
110
128
* [ File Server] ( file-server/file-server/main.go )
@@ -123,6 +141,7 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
123
141
* [ Embedded Single Page Application with other routes] ( file-server/single-page-application/embedded-single-page-application-with-other-routes/main.go )
124
142
* [ Upload File] ( file-server/upload-file/main.go )
125
143
* [ Upload Multiple Files] ( file-server/upload-files/main.go )
144
+ * [ WebDAV] ( file-server/webdav/main.go )
126
145
* View
127
146
* [ Overview] ( view/overview/main.go )
128
147
* [ Layout] ( view/layout )
@@ -174,6 +193,7 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
174
193
* [ Webassembly] ( webassembly/main.go )
175
194
* Request Body
176
195
* [ Bind JSON] ( request-body/read-json/main.go )
196
+ * * [ JSON Stream and disable unknown fields] ( request-body/read-json-stream/main.go )
177
197
* * [ Struct Validation] ( request-body/read-json-struct-validation/main.go )
178
198
* [ Bind XML] ( request-body/read-xml/main.go )
179
199
* [ Bind MsgPack] ( request-body/read-msgpack/main.go )
@@ -195,9 +215,9 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
195
215
* [ Protocol Buffers] ( response-writer/protobuf/main.go )
196
216
* [ HTTP/2 Server Push] ( response-writer/http2push/main.go )
197
217
* [ Stream Writer] ( response-writer/stream-writer/main.go )
198
- * [ Transactions ] ( response-writer/transactions /main.go )
199
- * [ SSE] ( response-writer/sse/main.go )
200
- * [ SSE (third -party package usage for server sent events )] ( response-writer/sse-third-party/main.go )
218
+ * [ Server-Sent Events ] ( response-writer/sse /main.go )
219
+ * [ SSE 3rd-party (r3labs/sse) ] ( response-writer/sse-third-party /main.go )
220
+ * [ SSE 3rd -party (alexandrevicenzi/go-sse )] ( response-writer/sse-third-party-2 /main.go )
201
221
* Cache
202
222
* [ Simple] ( response-writer/cache/simple/main.go )
203
223
* [ Client-Side (304)] ( response-writer/cache/client-side/main.go )
@@ -209,7 +229,8 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
209
229
* [ Basic] ( i18n/basic )
210
230
* [ Ttemplates and Functions] ( i18n/template )
211
231
* [ Pluralization and Variables] ( i18n/plurals )
212
- * Authentication, Authorization & Bot Detection
232
+ * Authentication, Authorization & Bot Detection
233
+ * [ Recommended: Auth package and Single-Sign-On] ( auth/auth ) ** NEW (GO 1.18 Generics required)**
213
234
* Basic Authentication
214
235
* [ Basic] ( auth/basicauth/basic )
215
236
* [ Load from a slice of Users] ( auth/basicauth/users_list )
@@ -267,12 +288,14 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
267
288
* [ Hello world] ( mvc/hello-world/main.go )
268
289
* [ Basic] ( mvc/basic/main.go )
269
290
* [ Wildcard] ( mvc/basic/wildcard/main.go )
291
+ * [ Default request values] ( mvc/request-default-values/main.go )
270
292
* [ Singleton] ( mvc/singleton )
271
293
* [ Regexp] ( mvc/regexp/main.go )
272
294
* [ Session Controller] ( mvc/session-controller/main.go )
273
295
* [ Authenticated Controller] ( mvc/authenticated-controller/main.go )
274
296
* [ Versioned Controller] ( mvc/versioned-controller/main.go )
275
297
* [ Websocket Controller] ( mvc/websocket )
298
+ * [ Websocket + Authentication (Single-Sign-On)] ( mvc/websocket-auth ) ** NEW (GO 1.18 Generics required)**
276
299
* [ Register Middleware] ( mvc/middleware )
277
300
* [ gRPC] ( mvc/grpc-compatible )
278
301
* [ gRPC Bidirectional Stream] ( mvc/grpc-compatible-bidirectional-stream )
@@ -284,7 +307,6 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
284
307
* [ Handle errors using mvc.Result] ( mvc/error-handler-custom-result )
285
308
* [ Handle errors using PreflightResult] ( mvc/error-handler-preflight )
286
309
* [ Handle errors by hijacking the result] ( mvc/error-handler-hijack )
287
- * [ Bootstrapper] ( bootstrapper )
288
310
* Desktop Applications
289
311
* [ The blink package] ( desktop/blink )
290
312
* [ The lorca package] ( desktop/lorca )
@@ -293,9 +315,9 @@ To read the Iris documentation please navigate to [the wiki pages](https://githu
293
315
294
316
## Run
295
317
296
- 1 . Install the Go Programming Language, version 1.15 + from [ here] ( https://golang.org /dl ) .
318
+ 1 . Install the Go Programming Language, version 1.18 + from [ here] ( https://go.dev /dl/ ) .
297
319
2 . [ Download the examples] ( https://github.com/iris-contrib/examples/archive/master.zip ) and copy-paste them to your ` $GOPATH/src/github.com/iris-contrib/examples `
298
- 3 . Install Iris with
` go get -u github.com/kataras/iris/[email protected] alpha2 `
320
+ 3 . Install Iris with
` go get -u github.com/kataras/iris/[email protected] beta3 `
299
321
300
322
To run an example, open a terminal session and execute:
301
323
0 commit comments