_examples/

directory
v12.2.0-beta3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2022 License: BSD-3-Clause

README

Table of Contents

Directories

Path Synopsis
cors
Package main integrates the "rs/cors" net/http middleware into Iris.
Package main integrates the "rs/cors" net/http middleware into Iris.
caddy
configuration
convert-handlers
cookies
database
dependency-injection
jwt
desktop
dropzonejs
src
embedding-files-into-app
Package main generated by go-bindata.// sources: assets/css/main.css assets/favicon.ico assets/js/main.js
Package main generated by go-bindata.// sources: assets/css/main.css assets/favicon.ico assets/js/main.js
embedding-gzipped-files-into-app
Package main generated by go-bindata.// sources: ../embedding-files-into-app/assets/css/main.css ../embedding-files-into-app/assets/favicon.ico ../embedding-files-into-app/assets/js/main.js
Package main generated by go-bindata.// sources: ../embedding-files-into-app/assets/css/main.css ../embedding-files-into-app/assets/favicon.ico ../embedding-files-into-app/assets/js/main.js
http2push-embedded
Package main generated by go-bindata.// sources: ../http2push/assets/app2/app2app3/css/main.css ../http2push/assets/app2/app2app3/dirs/dir1/text.txt ../http2push/assets/app2/app2app3/dirs/dir2/text.txt ../http2push/assets/app2/app2app3/dirs/text.txt ../http2push/assets/app2/app2app3/index.html ../http2push/assets/app2/index.html ../http2push/assets/app2/mydir/text.txt ../http2push/assets/css/main.css ../http2push/assets/favicon.ico ../http2push/assets/index.html ../http2push/assets/js/main.js
Package main generated by go-bindata.// sources: ../http2push/assets/app2/app2app3/css/main.css ../http2push/assets/app2/app2app3/dirs/dir1/text.txt ../http2push/assets/app2/app2app3/dirs/dir2/text.txt ../http2push/assets/app2/app2app3/dirs/text.txt ../http2push/assets/app2/app2app3/index.html ../http2push/assets/app2/index.html ../http2push/assets/app2/mydir/text.txt ../http2push/assets/css/main.css ../http2push/assets/favicon.ico ../http2push/assets/index.html ../http2push/assets/js/main.js
http2push-embedded-gzipped
Package main generated by go-bindata.// sources: ../http2push/assets/app2/app2app3/css/main.css ../http2push/assets/app2/app2app3/dirs/dir1/text.txt ../http2push/assets/app2/app2app3/dirs/dir2/text.txt ../http2push/assets/app2/app2app3/dirs/text.txt ../http2push/assets/app2/app2app3/index.html ../http2push/assets/app2/index.html ../http2push/assets/app2/mydir/text.txt ../http2push/assets/css/main.css ../http2push/assets/favicon.ico ../http2push/assets/index.html ../http2push/assets/js/main.js
Package main generated by go-bindata.// sources: ../http2push/assets/app2/app2app3/css/main.css ../http2push/assets/app2/app2app3/dirs/dir1/text.txt ../http2push/assets/app2/app2app3/dirs/dir2/text.txt ../http2push/assets/app2/app2app3/dirs/text.txt ../http2push/assets/app2/app2app3/index.html ../http2push/assets/app2/index.html ../http2push/assets/app2/mydir/text.txt ../http2push/assets/css/main.css ../http2push/assets/favicon.ico ../http2push/assets/index.html ../http2push/assets/js/main.js
single-page-application/embedded-single-page-application
Package main generated by go-bindata.// sources: data/public/app.js data/public/app2/index.html data/public/css/main.css data/views/index.html
Package main generated by go-bindata.// sources: data/public/app.js data/public/app2/index.html data/public/css/main.css data/views/index.html
single-page-application/embedded-single-page-application-with-other-routes
Package main generated by go-bindata.// sources: public/app.js public/css/main.css public/index.html
Package main generated by go-bindata.// sources: public/app.js public/css/main.css public/index.html
spa-vue-router
Package main simply shows how you can getting started with Iris and Vue Router.
Package main simply shows how you can getting started with Iris and Vue Router.
http-client
http-server
listen-letsencrypt
Package main provide one-line integration with letsencrypt.org
Package main provide one-line integration with letsencrypt.org
i18n
logging
request-logger/accesslog-formatter
Package main shows how to create a quite fast custom Log Formatter.
Package main shows how to create a quite fast custom Log Formatter.
request-logger/accesslog-proxy
Package main is a proxy + accesslog example.
Package main is a proxy + accesslog example.
monitor
mvc
authenticated-controller
Package main shows how to use a dependency to check if a user is logged in using a special custom Go type `Authenticated`, which when, present on a controller's method or a field then it limits the visibility to "authenticated" users only.
Package main shows how to use a dependency to check if a user is logged in using a special custom Go type `Authenticated`, which when, present on a controller's method or a field then it limits the visibility to "authenticated" users only.
grpc-compatible/grpc-client
Package main implements a client for Greeter service.
Package main implements a client for Greeter service.
middleware
Package main shows how you can add middleware to an mvc Application, simply by using its `Router` which is a sub router(an iris.Party) of the main iris app.
Package main shows how you can add middleware to an mvc Application, simply by using its `Router` which is a sub router(an iris.Party) of the main iris app.
middleware/per-method
If you want to use it as middleware for the entire controller you can use its router which is just a sub router to add it as you normally do with standard API: I'll show you 4 different methods for adding a middleware into an mvc application, all of those 4 do exactly the same thing, select what you prefer, I prefer the last code-snippet when I need the middleware to be registered somewhere else as well, otherwise I am going with the first one: “`go // 1 mvc.Configure(app.Party("/user"), func(m *mvc.Application) { m.Router.Use(cache.Handler(10*time.Second)) }) “` “`go // 2 // same: userRouter := app.Party("/user") userRouter.Use(cache.Handler(10*time.Second)) mvc.Configure(userRouter, ...) “` “`go // 3 // same: userRouter := app.Party("/user", cache.Handler(10*time.Second)) mvc.Configure(userRouter, ...) “` “`go // 4 // same: app.PartyFunc("/user", func(r iris.Party){ r.Use(cache.Handler(10*time.Second)) mvc.Configure(r, ...) }) “` If you want to use a middleware for a single route, for a single controller's method that is already registered by the engine and not by custom `Handle` (which you can add the middleware there on the last parameter) and it's not depend on the `Next Handler` to do its job then you just call it on the method: “`go var myMiddleware := myMiddleware.New(...) // this should return an iris/context.Handler type UserController struct{} func (c *UserController) GetSomething(ctx iris.Context) { // ctx.Proceed checks if myMiddleware called `ctx.Next()` // inside it and returns true if so, otherwise false.
If you want to use it as middleware for the entire controller you can use its router which is just a sub router to add it as you normally do with standard API: I'll show you 4 different methods for adding a middleware into an mvc application, all of those 4 do exactly the same thing, select what you prefer, I prefer the last code-snippet when I need the middleware to be registered somewhere else as well, otherwise I am going with the first one: “`go // 1 mvc.Configure(app.Party("/user"), func(m *mvc.Application) { m.Router.Use(cache.Handler(10*time.Second)) }) “` “`go // 2 // same: userRouter := app.Party("/user") userRouter.Use(cache.Handler(10*time.Second)) mvc.Configure(userRouter, ...) “` “`go // 3 // same: userRouter := app.Party("/user", cache.Handler(10*time.Second)) mvc.Configure(userRouter, ...) “` “`go // 4 // same: app.PartyFunc("/user", func(r iris.Party){ r.Use(cache.Handler(10*time.Second)) mvc.Configure(r, ...) }) “` If you want to use a middleware for a single route, for a single controller's method that is already registered by the engine and not by custom `Handle` (which you can add the middleware there on the last parameter) and it's not depend on the `Next Handler` to do its job then you just call it on the method: “`go var myMiddleware := myMiddleware.New(...) // this should return an iris/context.Handler type UserController struct{} func (c *UserController) GetSomething(ctx iris.Context) { // ctx.Proceed checks if myMiddleware called `ctx.Next()` // inside it and returns true if so, otherwise false.
middleware/without-ctx-next
Package main shows how to add done handlers in an MVC application without the necessity of `ctx.Next()` inside the controller's methods.
Package main shows how to add done handlers in an MVC application without the necessity of `ctx.Next()` inside the controller's methods.
regexp
Package main shows how to match "/xxx.json" in MVC handler.
Package main shows how to match "/xxx.json" in MVC handler.
request-body
form-query-headers-params-decoder
package main contains an example on how to register a custom decoder for a custom type when using the `ReadQuery/ReadParams/ReadHeaders/ReadForm` methods.
package main contains an example on how to register a custom decoder for a custom type when using the `ReadQuery/ReadParams/ReadHeaders/ReadForm` methods.
read-form
package main contains an example on how to use the ReadForm, but with the same way you can do the ReadJSON & ReadJSON
package main contains an example on how to use the ReadForm, but with the same way you can do the ReadJSON & ReadJSON
read-headers
package main contains an example on how to use the ReadHeaders, same way you can do the ReadQuery, ReadJSON, ReadProtobuf and e.t.c.
package main contains an example on how to use the ReadHeaders, same way you can do the ReadQuery, ReadJSON, ReadProtobuf and e.t.c.
read-json-struct-validation
Package main shows the validator(latest, version 10) integration with Iris' Context methods of `ReadJSON`, `ReadXML`, `ReadMsgPack`, `ReadYAML`, `ReadForm`, `ReadQuery`, `ReadBody`.
Package main shows the validator(latest, version 10) integration with Iris' Context methods of `ReadJSON`, `ReadXML`, `ReadMsgPack`, `ReadYAML`, `ReadForm`, `ReadQuery`, `ReadBody`.
read-params
package main contains an example on how to use the ReadParams, same way you can do the ReadQuery, ReadJSON, ReadProtobuf and e.t.c.
package main contains an example on how to use the ReadParams, same way you can do the ReadQuery, ReadJSON, ReadProtobuf and e.t.c.
read-query
package main contains an example on how to use the ReadQuery, same way you can do the ReadJSON & ReadProtobuf and e.t.c.
package main contains an example on how to use the ReadQuery, same way you can do the ReadJSON & ReadProtobuf and e.t.c.
read-url
package main contains an example on how to use the ReadURL, same way you can do the ReadQuery, ReadParams, ReadJSON, ReadProtobuf and e.t.c.
package main contains an example on how to use the ReadURL, same way you can do the ReadQuery, ReadParams, ReadJSON, ReadProtobuf and e.t.c.
response-writer
cache/client-side
Package main shows how you can use the `WriteWithExpiration` based on the "modtime", if it's newer than the request header then it will refresh the contents, otherwise will let the client (99.9% the browser) to handle the cache mechanism, it's faster than iris.Cache because server-side has nothing to do and no need to store the responses in the memory.
Package main shows how you can use the `WriteWithExpiration` based on the "modtime", if it's newer than the request header then it will refresh the contents, otherwise will let the client (99.9% the browser) to handle the cache mechanism, it's faster than iris.Cache because server-side has nothing to do and no need to store the responses in the memory.
content-negotiation
Package main contains three different ways to render content based on the client's accepted.
Package main contains three different ways to render content based on the client's accepted.
http2push
Server push lets the server preemptively "push" website assets to the client without the user having explicitly asked for them.
Server push lets the server preemptively "push" website assets to the client without the user having explicitly asked for them.
sse
Package main shows how to send continuous event messages to the clients through SSE via a broker.
Package main shows how to send continuous event messages to the clients through SSE via a broker.
macros
Package main shows how you can register a custom parameter type and macro functions that belongs to it.
Package main shows how you can register a custom parameter type and macro functions that belongs to it.
route-handlers-execution-rules
Package main is a simple example of the behavior change of the execution flow of the handlers, normally we need the `ctx.Next()` to call the next handler in a route's handler chain, but with the `ExecutionRules` we can change this default behavior.
Package main is a simple example of the behavior change of the execution flow of the handlers, normally we need the `ctx.Next()` to call the next handler in a route's handler chain, but with the `ExecutionRules` we can change this default behavior.
subdomains/single
Package main register static subdomains, simple as parties, check ./hosts if you use windows
Package main register static subdomains, simple as parties, check ./hosts if you use windows
subdomains/wildcard
Package main an example on how to catch dynamic subdomains - wildcard.
Package main an example on how to catch dynamic subdomains - wildcard.
writing-a-middleware/share-funcs
Package main shows how you can share a function between handlers of the same chain.
Package main shows how you can share a function between handlers of the same chain.
sessions
testing
Package main shows how you can create a simple URL Shortener.
Package main shows how you can create a simple URL Shortener.
view
embedding-templates-into-app
Package main generated by go-bindata.// sources: templates/layouts/layout.html templates/layouts/mylayout.html templates/page1.html templates/partials/page1_partial1.html
Package main generated by go-bindata.// sources: templates/layouts/layout.html templates/layouts/mylayout.html templates/page1.html templates/partials/page1_partial1.html
herotemplate/template
Code generated by hero.
Code generated by hero.
parse-template
Package main shows how to parse a template through custom byte slice content.
Package main shows how to parse a template through custom byte slice content.
template_amber_1_embedded
Package main generated by go-bindata.// sources: ../template_amber_0/views/index.amber ../template_amber_0/views/layouts/main.amber
Package main generated by go-bindata.// sources: ../template_amber_0/views/index.amber ../template_amber_0/views/layouts/main.amber
template_blocks_1_embedded
Package main generated by go-bindata.// sources: ../template_blocks_0/views/500.html ../template_blocks_0/views/index.html ../template_blocks_0/views/layouts/error.html ../template_blocks_0/views/layouts/main.html ../template_blocks_0/views/partials/footer.html
Package main generated by go-bindata.// sources: ../template_blocks_0/views/500.html ../template_blocks_0/views/index.html ../template_blocks_0/views/layouts/error.html ../template_blocks_0/views/layouts/main.html ../template_blocks_0/views/partials/footer.html
template_html_3
Package main an example on how to naming your routes & use the custom 'url path' HTML Template Engine, same for other template engines.
Package main an example on how to naming your routes & use the custom 'url path' HTML Template Engine, same for other template engines.
template_html_4
Package main an example on how to naming your routes & use the custom 'url' HTML Template Engine, same for other template engines.
Package main an example on how to naming your routes & use the custom 'url' HTML Template Engine, same for other template engines.
template_jet_0
Package main shows how to use jet template parser with ease using the Iris built-in Jet view engine.
Package main shows how to use jet template parser with ease using the Iris built-in Jet view engine.
template_jet_1_embedded
Package main generated by go-bindata.// sources: views/includes/_partial.jet views/includes/blocks.jet views/index.jet views/layouts/application.jet Package main shows how to use jet templates embedded in your application with ease using the Iris built-in Jet view engine.
Package main generated by go-bindata.// sources: views/includes/_partial.jet views/includes/blocks.jet views/index.jet views/layouts/application.jet Package main shows how to use jet templates embedded in your application with ease using the Iris built-in Jet view engine.
template_jet_2
Package main an example on how to naming your routes & use the custom 'url path' Jet Template Engine.
Package main an example on how to naming your routes & use the custom 'url path' Jet Template Engine.
template_pug_0
Package main shows an example of pug actions based on https://github.com/Joker/jade/tree/master/example/actions
Package main shows an example of pug actions based on https://github.com/Joker/jade/tree/master/example/actions
template_pug_2_embedded
Package main generated by go-bindata.// sources: templates/index.pug templates/layout.pug
Package main generated by go-bindata.// sources: templates/index.pug templates/layout.pug
websocket

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL