From 55c250c93a7142a1d1710b6c25857799cca4d10a Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Fri, 24 Mar 2017 00:22:05 +0200 Subject: [PATCH] Add More Examples & Categorized in Folders & TOC Former-commit-id: ce4d711a75a4ba08ffab075e6baa88724725885b --- README.md | 13 ++- _examples/README.md | 72 +++++++++++----- .../examples/advanced/cloud-editor}/main.go | 0 .../advanced/cloud-editor}/www/index.html | 0 .../advanced/cloud-editor}/www/scripts/app.ts | 0 .../cloud-editor}/www/scripts/tsconfig.json | 0 .../examples/advanced/httptest}/main.go | 0 .../examples/advanced/httptest}/main_test.go | 0 .../{ => advanced}/online-visitors/main.go | 0 .../static/assets/js/visitors.js | 0 .../online-visitors/templates/index.html | 0 .../online-visitors/templates/other.html | 0 .../examples/advanced/typescript}/main.go | 0 .../advanced/typescript}/www/index.html | 0 .../advanced/typescript}/www/scripts/app.ts | 0 .../{ => advanced}/url-shortener/main.go | 0 .../url-shortener/resources/css/style.css | 0 .../{ => advanced}/url-shortener/shortener.go | 0 .../url-shortener/templates/index.html | 0 .../examples/{ => beginner}/favicon/main.go | 0 .../static/favicons/iris_favicon_32_32.ico | Bin .../file-server}/assets/css/styles.css | 0 .../file-server}/main.go | 0 .../{ => beginner}/hello-world/main.go | 0 _examples/examples/beginner/read-form/main.go | 42 ++++++++++ .../beginner/read-form/templates/form.html | 19 +++++ _examples/examples/beginner/read-json/main.go | 36 ++++++++ .../beginner/routes-using-gorillamux}/main.go | 0 .../beginner/routes-using-httprouter}/main.go | 0 .../beginner/send-files/files/first.zip | Bin 0 -> 35369 bytes .../examples/beginner/send-files/main.go | 21 +++++ .../{json => beginner/write-json}/main.go | 0 _examples/examples/forms/main.go | 47 ----------- .../examples/forms/mytemplates/forms.html | 14 ---- .../examples/intermediate/basicauth}/main.go | 0 .../{ => intermediate}/cache-markdown/main.go | 0 .../examples/intermediate/cors}/main.go | 0 .../examples/intermediate/e-mail/main.go | 77 ++++++++++++++++++ .../e-mail/templates/mail_body.html | 7 ++ .../intermediate/flash-messages/main.go | 45 ++++++++++ .../intermediate/graceful-shutdown/main.go | 32 ++++++++ .../i18n}/locales/locale_el-GR.ini | 0 .../i18n}/locales/locale_en-US.ini | 0 .../i18n}/locales/locale_zh-CN.ini | 0 .../examples/intermediate/i18n}/main.go | 0 .../password-hashing/main.go | 0 .../examples/intermediate/pprof}/main.go | 0 .../examples/intermediate/recover}/main.go | 0 .../intermediate/request-logger}/main.go | 0 .../intermediate/sessions}/database/main.go | 0 .../sessions/overview}/main.go | 0 .../sessions}/securecookie/main.go | 0 .../intermediate/sessions}/standalone/main.go | 0 .../{ => intermediate}/upload-files/main.go | 0 .../upload-files/templates/upload_form.html | 0 .../view/custom-renderer}/main.go | 0 .../embedding-templates-into-app}/bindata.go | 0 .../embedding-templates-into-app}/main.go | 0 .../templates/hi.html | 0 .../intermediate/view}/overview/main.go | 0 .../view}/overview/templates/hi.html | 0 .../view}/template_html_0/main.go | 0 .../view}/template_html_0/templates/hi.html | 0 .../view}/template_html_1/main.go | 0 .../template_html_1/templates/layout.html | 0 .../template_html_1/templates/mypage.html | 0 .../view}/template_html_2/README.md | 0 .../view}/template_html_2/main.go | 0 .../templates/layouts/layout.html | 0 .../templates/layouts/mylayout.html | 0 .../template_html_2/templates/page1.html | 0 .../templates/partials/page1_partial1.html | 0 .../view}/template_html_3/main.go | 0 .../view}/template_html_3/templates/page.html | 0 .../intermediate/view}/template_html_4/hosts | 0 .../view}/template_html_4/main.go | 0 .../view}/template_html_4/templates/page.html | 0 .../websockets/connectionlist}/main.go | 0 .../connectionlist}/static/js/chat.js | 0 .../connectionlist}/templates/client.html | 0 .../websockets/custom-go-client}/main.go | 0 .../websockets/native-messages}/main.go | 0 .../native-messages}/static/js/chat.js | 0 .../native-messages}/templates/client.html | 0 .../intermediate/websockets/overview}/main.go | 0 .../websockets/overview}/static/js/chat.js | 0 .../overview}/templates/client.html | 0 .../websockets/ridiculous-simple}/main.go | 0 .../ridiculous-simple}/websockets.html | 0 .../intermediate/websockets/secure}/main.go | 0 .../websockets/secure}/static/js/chat.js | 0 .../websockets/secure}/templates/client.html | 0 .../examples/routes-using-gorillamux/main.go | 28 ------- .../examples/routes-using-httprouter/main.go | 27 ------ _examples/examples/templates/main.go | 39 --------- .../examples/templates/mytemplates/todos.html | 10 --- doc.go | 2 +- 97 files changed, 338 insertions(+), 193 deletions(-) rename {adaptors/typescript/editor/_example => _examples/examples/advanced/cloud-editor}/main.go (100%) rename {adaptors/typescript/_example => _examples/examples/advanced/cloud-editor}/www/index.html (100%) rename {adaptors/typescript/editor/_example => _examples/examples/advanced/cloud-editor}/www/scripts/app.ts (100%) rename {adaptors/typescript/editor/_example => _examples/examples/advanced/cloud-editor}/www/scripts/tsconfig.json (100%) rename {httptest/_example => _examples/examples/advanced/httptest}/main.go (100%) rename {httptest/_example => _examples/examples/advanced/httptest}/main_test.go (100%) rename _examples/examples/{ => advanced}/online-visitors/main.go (100%) rename _examples/examples/{ => advanced}/online-visitors/static/assets/js/visitors.js (100%) rename _examples/examples/{ => advanced}/online-visitors/templates/index.html (100%) rename _examples/examples/{ => advanced}/online-visitors/templates/other.html (100%) rename {adaptors/typescript/_example => _examples/examples/advanced/typescript}/main.go (100%) rename {adaptors/typescript/editor/_example => _examples/examples/advanced/typescript}/www/index.html (100%) rename {adaptors/typescript/_example => _examples/examples/advanced/typescript}/www/scripts/app.ts (100%) rename _examples/examples/{ => advanced}/url-shortener/main.go (100%) rename _examples/examples/{ => advanced}/url-shortener/resources/css/style.css (100%) rename _examples/examples/{ => advanced}/url-shortener/shortener.go (100%) rename _examples/examples/{ => advanced}/url-shortener/templates/index.html (100%) rename _examples/examples/{ => beginner}/favicon/main.go (100%) rename _examples/examples/{ => beginner}/favicon/static/favicons/iris_favicon_32_32.ico (100%) rename _examples/examples/{static-files => beginner/file-server}/assets/css/styles.css (100%) rename _examples/examples/{static-files => beginner/file-server}/main.go (100%) rename _examples/examples/{ => beginner}/hello-world/main.go (100%) create mode 100644 _examples/examples/beginner/read-form/main.go create mode 100644 _examples/examples/beginner/read-form/templates/form.html create mode 100644 _examples/examples/beginner/read-json/main.go rename {adaptors/gorillamux/_example => _examples/examples/beginner/routes-using-gorillamux}/main.go (100%) rename {adaptors/httprouter/_example => _examples/examples/beginner/routes-using-httprouter}/main.go (100%) create mode 100644 _examples/examples/beginner/send-files/files/first.zip create mode 100644 _examples/examples/beginner/send-files/main.go rename _examples/examples/{json => beginner/write-json}/main.go (100%) delete mode 100644 _examples/examples/forms/main.go delete mode 100644 _examples/examples/forms/mytemplates/forms.html rename {middleware/basicauth/_example => _examples/examples/intermediate/basicauth}/main.go (100%) rename _examples/examples/{ => intermediate}/cache-markdown/main.go (100%) rename {adaptors/cors/_example => _examples/examples/intermediate/cors}/main.go (100%) create mode 100644 _examples/examples/intermediate/e-mail/main.go create mode 100644 _examples/examples/intermediate/e-mail/templates/mail_body.html create mode 100644 _examples/examples/intermediate/flash-messages/main.go create mode 100644 _examples/examples/intermediate/graceful-shutdown/main.go rename {middleware/i18n/_example => _examples/examples/intermediate/i18n}/locales/locale_el-GR.ini (100%) rename {middleware/i18n/_example => _examples/examples/intermediate/i18n}/locales/locale_en-US.ini (100%) rename {middleware/i18n/_example => _examples/examples/intermediate/i18n}/locales/locale_zh-CN.ini (100%) rename {middleware/i18n/_example => _examples/examples/intermediate/i18n}/main.go (100%) rename _examples/examples/{ => intermediate}/password-hashing/main.go (100%) rename {middleware/pprof/_example => _examples/examples/intermediate/pprof}/main.go (100%) rename {middleware/recover/_example => _examples/examples/intermediate/recover}/main.go (100%) rename {middleware/logger/_example => _examples/examples/intermediate/request-logger}/main.go (100%) rename {adaptors/sessions/_examples => _examples/examples/intermediate/sessions}/database/main.go (100%) rename _examples/examples/{sessions => intermediate/sessions/overview}/main.go (100%) rename {adaptors/sessions/_examples => _examples/examples/intermediate/sessions}/securecookie/main.go (100%) rename {adaptors/sessions/_examples => _examples/examples/intermediate/sessions}/standalone/main.go (100%) rename _examples/examples/{ => intermediate}/upload-files/main.go (100%) rename _examples/examples/{ => intermediate}/upload-files/templates/upload_form.html (100%) rename {adaptors/view/_examples/custom_renderer => _examples/examples/intermediate/view/custom-renderer}/main.go (100%) rename {adaptors/view/_examples/template_binary => _examples/examples/intermediate/view/embedding-templates-into-app}/bindata.go (100%) rename {adaptors/view/_examples/template_binary => _examples/examples/intermediate/view/embedding-templates-into-app}/main.go (100%) rename {adaptors/view/_examples/template_binary => _examples/examples/intermediate/view/embedding-templates-into-app}/templates/hi.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/overview/main.go (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/overview/templates/hi.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_0/main.go (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_0/templates/hi.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_1/main.go (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_1/templates/layout.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_1/templates/mypage.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_2/README.md (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_2/main.go (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_2/templates/layouts/layout.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_2/templates/layouts/mylayout.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_2/templates/page1.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_2/templates/partials/page1_partial1.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_3/main.go (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_3/templates/page.html (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_4/hosts (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_4/main.go (100%) rename {adaptors/view/_examples => _examples/examples/intermediate/view}/template_html_4/templates/page.html (100%) rename {adaptors/websocket/_examples/websocket_connectionlist => _examples/examples/intermediate/websockets/connectionlist}/main.go (100%) rename {adaptors/websocket/_examples/websocket => _examples/examples/intermediate/websockets/connectionlist}/static/js/chat.js (100%) rename {adaptors/websocket/_examples/websocket => _examples/examples/intermediate/websockets/connectionlist}/templates/client.html (100%) rename {adaptors/websocket/_examples/websocket_custom_go_client => _examples/examples/intermediate/websockets/custom-go-client}/main.go (100%) rename {adaptors/websocket/_examples/websocket_native_messages => _examples/examples/intermediate/websockets/native-messages}/main.go (100%) rename {adaptors/websocket/_examples/websocket_native_messages => _examples/examples/intermediate/websockets/native-messages}/static/js/chat.js (100%) rename {adaptors/websocket/_examples/websocket_native_messages => _examples/examples/intermediate/websockets/native-messages}/templates/client.html (100%) rename {adaptors/websocket/_examples/websocket => _examples/examples/intermediate/websockets/overview}/main.go (100%) rename {adaptors/websocket/_examples/websocket_connectionlist => _examples/examples/intermediate/websockets/overview}/static/js/chat.js (100%) rename {adaptors/websocket/_examples/websocket_connectionlist => _examples/examples/intermediate/websockets/overview}/templates/client.html (100%) rename _examples/examples/{websockets => intermediate/websockets/ridiculous-simple}/main.go (100%) rename _examples/examples/{websockets => intermediate/websockets/ridiculous-simple}/websockets.html (100%) rename {adaptors/websocket/_examples/websocket_secure => _examples/examples/intermediate/websockets/secure}/main.go (100%) rename {adaptors/websocket/_examples/websocket_secure => _examples/examples/intermediate/websockets/secure}/static/js/chat.js (100%) rename {adaptors/websocket/_examples/websocket_secure => _examples/examples/intermediate/websockets/secure}/templates/client.html (100%) delete mode 100644 _examples/examples/routes-using-gorillamux/main.go delete mode 100644 _examples/examples/routes-using-httprouter/main.go delete mode 100644 _examples/examples/templates/main.go delete mode 100644 _examples/examples/templates/mytemplates/todos.html diff --git a/README.md b/README.md index 55247214..595e36ff 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Feature Overview - Automatically install and serve certificates from https://letsencrypt.org - Robust routing and middleware ecosystem - Build RESTful APIs -- Choose your favorite routes' path syntax between [httprouter](https://github.com/kataras/iris/blob/v6/adaptors/httprouter/_example/main.go) and [gorillamux](https://github.com/kataras/iris/blob/v6/adaptors/gorillamux/_example/main.go) +- Choose your favorite routes' path syntax between [httprouter](https://github.com/kataras/iris/blob/v6/_examples/beginner/routes-using-httprouter/main.go) and [gorillamux](https://github.com/kataras/iris/blob/v6/_examples/beginner/routes-using-gorillamux/main.go) - Request-Scoped Transactions - Group API's and subdomains with wildcard support - Body binding for JSON, XML, Forms, can be extended to use your own custom binders @@ -275,12 +275,9 @@ FAQ & Documentation 4. [Creating A URL Shortener Service Using Go, Iris, and Bolt](https://medium.com/@kataras/a-url-shortener-service-using-go-iris-and-bolt-4182f0b00ae7) -5. [./adaptors](https://github.com/kataras/iris/tree/v6/adaptors) and [./middleware](https://github.com/kataras/iris/tree/v6/middleware) contains examples of their usage +5. [Godocs](https://godoc.org/gopkg.in/kataras/iris.v6) for deep documentation -6. [Godocs](https://godoc.org/gopkg.in/kataras/iris.v6) for deep documentation - - -7. [HISTORY.md](https://github.com//kataras/iris/tree/v6/HISTORY.md) is your best friend, version migrations are released there +6. [HISTORY.md](https://github.com//kataras/iris/tree/v6/HISTORY.md) is your best friend, version migrations are released there I'll be glad to talk with you about **your awesome feature requests**, @@ -480,14 +477,14 @@ i.e: - [transaction_test.go](https://github.com/kataras/iris/blob/v6/transaction_test.go) - [serializer_test.go](https://github.com/kataras/iris/blob/v6/serializer_test.go) -A simple test is located to [./httptest/_example/main_test.go](https://github.com/kataras/iris/blob/v6/httptest/_example/main_test.go) +A simple test is located to [./_examples/advanced/httptest/main_test.go](https://github.com/kataras/iris/blob/v6/_examples/advanced/httptest/main_test.go) Philosophy ------------ The Iris philosophy is to provide robust tooling for HTTP, making it a great solution for single page applications, web sites, hybrids, or public HTTP APIs. Keep note that, today, iris is faster than nginx itself. -Iris does not force you to use any specific ORM or template engine. Iris is routerless which means you can adapt any router you like, [httprouter](https://github.com/kataras/iris/blob/v6/adaptors/httprouter/_example/main.go) is the fastest, [gorillamux](https://github.com/kataras/iris/blob/v6/adaptors/gorillamux/_example/main.go) has more features. With support for the most used template engines (5), you can quickly craft the perfect application. +Iris does not force you to use any specific ORM or template engine. Iris is routerless which means you can adapt any router you like, [httprouter](https://github.com/kataras/iris/blob/v6/_examples/beginner/routes-using-httprouter/main.go) is the fastest, [gorillamux](https://github.com/kataras/iris/blob/v6/_examples/beginner/routes-using-gorillamux/main.go) has more features. With support for the most used template engines (5), you can quickly craft the perfect application. People diff --git a/_examples/README.md b/_examples/README.md index 04fb335a..555403d7 100644 --- a/_examples/README.md +++ b/_examples/README.md @@ -1,4 +1,4 @@ -## Examples +# Examples This folder 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. @@ -8,26 +8,60 @@ It doesn't contains "best ways" neither explains all its features. It's just a s Developers should read the official [documentation](https://godoc.org/gopkg.in/kataras/iris.v6) in depth. - + ## Table of Contents -* [Hello World](examples/hello-world/main.go) -* [Routes (using httprouter)](examples/routes-using-httprouter/main.go) -* [Routes (using gorillamux)](examples/routes-using-gorillamux/main.go) -* [Templates](examples/templates/main.go) -* [Forms](examples/forms/main.go) -* [JSON](examples/json/main.go) -* [Upload Files](examples/upload-files/main.go) -* [Static Files](examples/static-files/main.go) -* [Favicon](examples/favicon/main.go) -* [Password Hashing](examples/password-hashing/main.go) -* [Sessions](examples/sessions/main.go) -* [Websockets](examples/websockets/main.go) -* [Markdown and Cache](examples/cache-markdown/main.go) -* [Online Visitors](examples/online-visitors/main.go) -* [URL Shortener using BoltDB](examples/url-shortener/main.go) +* [Level: Beginner](examples/beginner) + * [Hello World](examples/beginner/hello-world/main.go) + * [Routes (using httprouter)](examples/beginner/routes-using-httprouter/main.go) + * [Routes (using gorillamux)](examples/beginner/routes-using-gorillamux/main.go) + * [Write JSON](examples/beginner/write-json/main.go) + * [Read JSON](examples/beginner/read-json/main.go) + * [Read Form](examples/beginner/read-form/main.go) + * [Favicon](examples/beginner/favicon/main.go) + * [File Server](examples/beginner/file-server/main.go) + * [Send Files](examples/beginner/send-files/main.go) +* [Level: Intermediate](examples/intermediate) + * [Send An E-mail](examples/intermediate/e-mail/main.go) + * [Upload/Read Files](examples/intermediate/upload-files/main.go) + * [Request Logger](examples/intermediate/request-logger/main.go) + * [Profiling (pprof)](examples/intermediate/pprof/main.go) + * [Basic Authentication](examples/intermediate/basicauth/main.go) + * [HTTP Access Control](examples/intermediate/cors/main.go) + * [Cache Markdown](examples/intermediate/cache-markdown/main.go) + * [Localization and Internationalization](examples/intermediate/i18n/main.go) + * [Recovery](examples/intermediate/recover/main.go) + * [Graceful Shutdown](examples/intermediate/graceful-shutdown/main.go) + * [View Engine](examples/intermediate/view) + * [Overview](examples/intermediate/view/overview/main.go) + * [Embedding Templates Into Executable](examples/intermediate/embedding-templates-into-app) + * [Template HTML: Part Zero](examples/intermediate/view/template_html_0/main.go) + * [Template HTML: Part One](examples/intermediate/view/template_html_1/main.go) + * [Template HTML: Part Two](examples/intermediate/view/template_html_2/main.go) + * [Template HTML: Part Three](examples/intermediate/view/template_html_3/main.go) + * [Template HTML: Part Four](examples/intermediate/view/template_html_4/main.go) + * [Custom Renderer](examples/intermediate/view/custom-renderer/main.go) + * [Password Hashing](examples/intermediate/password-hashing/main.go) + * [Sessions](examples/intermediate/sessions) + * [Overview](examples/intermediate/sessions/overview/main.go) + * [Encoding & Decoding the Session ID: Secure Cookie](examples/intermediate/sessions/securecookie/main.go) + * [Standalone](examples/intermediate/sessions/standalone/main.go) + * [With A Back-End Database](examples/intermediate/sessions/database/main.go) + * [Flash Messages](examples/intermediate/flash-messages/main.go) + * [Websockets](examples/intermediate/websockets) + * [Ridiculous Simple](examples/intermediate/websockets/ridiculous-simple/main.go) + * [Overview](examples/intermediate/websockets/overview/main.go) + * [Connection List](examples/intermediate/websockets/connectionlist/main.go) + * [Native Messages](examples/intermediate/websockets/naive-messages/main.go) + * [Secure](examples/intermediate/websockets/secure/main.go) + * [Custom Go Client](examples/intermediate/websockets/custom-go-client/main.go) +* [Level: Advanced](examples/advanced) + * [HTTP Testing](examples/advanced/httptest/main_test.go) + * [Watch & Compile Typescript source files](examples/advanced/typescript/main.go) + * [Cloud Editor](examples/advanced/cloud-editor/main.go) + * [Online Visitors](examples/advanced/online-visitors/main.go) + * [URL Shortener using BoltDB](examples/advanced/url-shortener/main.go) - -> Take look at the [community examples](https://github.com/iris-contrib/examples) too! \ No newline at end of file +> Take look at the [community examples](https://github.com/iris-contrib/examples) too! diff --git a/adaptors/typescript/editor/_example/main.go b/_examples/examples/advanced/cloud-editor/main.go similarity index 100% rename from adaptors/typescript/editor/_example/main.go rename to _examples/examples/advanced/cloud-editor/main.go diff --git a/adaptors/typescript/_example/www/index.html b/_examples/examples/advanced/cloud-editor/www/index.html similarity index 100% rename from adaptors/typescript/_example/www/index.html rename to _examples/examples/advanced/cloud-editor/www/index.html diff --git a/adaptors/typescript/editor/_example/www/scripts/app.ts b/_examples/examples/advanced/cloud-editor/www/scripts/app.ts similarity index 100% rename from adaptors/typescript/editor/_example/www/scripts/app.ts rename to _examples/examples/advanced/cloud-editor/www/scripts/app.ts diff --git a/adaptors/typescript/editor/_example/www/scripts/tsconfig.json b/_examples/examples/advanced/cloud-editor/www/scripts/tsconfig.json similarity index 100% rename from adaptors/typescript/editor/_example/www/scripts/tsconfig.json rename to _examples/examples/advanced/cloud-editor/www/scripts/tsconfig.json diff --git a/httptest/_example/main.go b/_examples/examples/advanced/httptest/main.go similarity index 100% rename from httptest/_example/main.go rename to _examples/examples/advanced/httptest/main.go diff --git a/httptest/_example/main_test.go b/_examples/examples/advanced/httptest/main_test.go similarity index 100% rename from httptest/_example/main_test.go rename to _examples/examples/advanced/httptest/main_test.go diff --git a/_examples/examples/online-visitors/main.go b/_examples/examples/advanced/online-visitors/main.go similarity index 100% rename from _examples/examples/online-visitors/main.go rename to _examples/examples/advanced/online-visitors/main.go diff --git a/_examples/examples/online-visitors/static/assets/js/visitors.js b/_examples/examples/advanced/online-visitors/static/assets/js/visitors.js similarity index 100% rename from _examples/examples/online-visitors/static/assets/js/visitors.js rename to _examples/examples/advanced/online-visitors/static/assets/js/visitors.js diff --git a/_examples/examples/online-visitors/templates/index.html b/_examples/examples/advanced/online-visitors/templates/index.html similarity index 100% rename from _examples/examples/online-visitors/templates/index.html rename to _examples/examples/advanced/online-visitors/templates/index.html diff --git a/_examples/examples/online-visitors/templates/other.html b/_examples/examples/advanced/online-visitors/templates/other.html similarity index 100% rename from _examples/examples/online-visitors/templates/other.html rename to _examples/examples/advanced/online-visitors/templates/other.html diff --git a/adaptors/typescript/_example/main.go b/_examples/examples/advanced/typescript/main.go similarity index 100% rename from adaptors/typescript/_example/main.go rename to _examples/examples/advanced/typescript/main.go diff --git a/adaptors/typescript/editor/_example/www/index.html b/_examples/examples/advanced/typescript/www/index.html similarity index 100% rename from adaptors/typescript/editor/_example/www/index.html rename to _examples/examples/advanced/typescript/www/index.html diff --git a/adaptors/typescript/_example/www/scripts/app.ts b/_examples/examples/advanced/typescript/www/scripts/app.ts similarity index 100% rename from adaptors/typescript/_example/www/scripts/app.ts rename to _examples/examples/advanced/typescript/www/scripts/app.ts diff --git a/_examples/examples/url-shortener/main.go b/_examples/examples/advanced/url-shortener/main.go similarity index 100% rename from _examples/examples/url-shortener/main.go rename to _examples/examples/advanced/url-shortener/main.go diff --git a/_examples/examples/url-shortener/resources/css/style.css b/_examples/examples/advanced/url-shortener/resources/css/style.css similarity index 100% rename from _examples/examples/url-shortener/resources/css/style.css rename to _examples/examples/advanced/url-shortener/resources/css/style.css diff --git a/_examples/examples/url-shortener/shortener.go b/_examples/examples/advanced/url-shortener/shortener.go similarity index 100% rename from _examples/examples/url-shortener/shortener.go rename to _examples/examples/advanced/url-shortener/shortener.go diff --git a/_examples/examples/url-shortener/templates/index.html b/_examples/examples/advanced/url-shortener/templates/index.html similarity index 100% rename from _examples/examples/url-shortener/templates/index.html rename to _examples/examples/advanced/url-shortener/templates/index.html diff --git a/_examples/examples/favicon/main.go b/_examples/examples/beginner/favicon/main.go similarity index 100% rename from _examples/examples/favicon/main.go rename to _examples/examples/beginner/favicon/main.go diff --git a/_examples/examples/favicon/static/favicons/iris_favicon_32_32.ico b/_examples/examples/beginner/favicon/static/favicons/iris_favicon_32_32.ico similarity index 100% rename from _examples/examples/favicon/static/favicons/iris_favicon_32_32.ico rename to _examples/examples/beginner/favicon/static/favicons/iris_favicon_32_32.ico diff --git a/_examples/examples/static-files/assets/css/styles.css b/_examples/examples/beginner/file-server/assets/css/styles.css similarity index 100% rename from _examples/examples/static-files/assets/css/styles.css rename to _examples/examples/beginner/file-server/assets/css/styles.css diff --git a/_examples/examples/static-files/main.go b/_examples/examples/beginner/file-server/main.go similarity index 100% rename from _examples/examples/static-files/main.go rename to _examples/examples/beginner/file-server/main.go diff --git a/_examples/examples/hello-world/main.go b/_examples/examples/beginner/hello-world/main.go similarity index 100% rename from _examples/examples/hello-world/main.go rename to _examples/examples/beginner/hello-world/main.go diff --git a/_examples/examples/beginner/read-form/main.go b/_examples/examples/beginner/read-form/main.go new file mode 100644 index 00000000..f659e195 --- /dev/null +++ b/_examples/examples/beginner/read-form/main.go @@ -0,0 +1,42 @@ +// package main contains an example on how to use the ReadForm, but with the same way you can do the ReadJSON & ReadJSON +package main + +import ( + "gopkg.in/kataras/iris.v6" + "gopkg.in/kataras/iris.v6/adaptors/httprouter" + "gopkg.in/kataras/iris.v6/adaptors/view" +) + +type Visitor struct { + Username string + Mail string + Data []string `form:"mydata"` +} + +func main() { + app := iris.New() + // output startup banner and error logs on os.Stdout + app.Adapt(iris.DevLogger()) + // set the router, you can choose gorillamux too + app.Adapt(httprouter.New()) + // set the view html template engine + app.Adapt(view.HTML("./templates", ".html")) + + app.Get("/", func(ctx *iris.Context) { + if err := ctx.Render("form.html", nil); err != nil { + ctx.Log(iris.DevMode, err.Error()) + } + }) + + app.Post("/form_action", func(ctx *iris.Context) { + visitor := Visitor{} + err := ctx.ReadForm(&visitor) + if err != nil { + ctx.Log(iris.DevMode, "Error when reading form: "+err.Error()) + } + + ctx.Writef("Visitor: %#v", visitor) + }) + + app.Listen(":8080") +} diff --git a/_examples/examples/beginner/read-form/templates/form.html b/_examples/examples/beginner/read-form/templates/form.html new file mode 100644 index 00000000..af68b075 --- /dev/null +++ b/_examples/examples/beginner/read-form/templates/form.html @@ -0,0 +1,19 @@ + + + + + +
+

+
+ + +
+ + diff --git a/_examples/examples/beginner/read-json/main.go b/_examples/examples/beginner/read-json/main.go new file mode 100644 index 00000000..46358a3c --- /dev/null +++ b/_examples/examples/beginner/read-json/main.go @@ -0,0 +1,36 @@ +package main + +import ( + "gopkg.in/kataras/iris.v6" + "gopkg.in/kataras/iris.v6/adaptors/httprouter" +) + +type Company struct { + Name string + City string + Other string +} + +func MyHandler(ctx *iris.Context) { + c := &Company{} + if err := ctx.ReadJSON(c); err != nil { + ctx.Log(iris.DevMode, err.Error()) + return + } + + ctx.Writef("Company: %#v\n", c) +} + +func main() { + app := iris.New() + // output startup banner and error logs on os.Stdout + app.Adapt(iris.DevLogger()) + // set the router, you can choose gorillamux too + app.Adapt(httprouter.New()) + + // use postman or whatever to do a POST request + // to the http://localhost:8080 with BODY: JSON PAYLOAD + // and Content-Type to application/json + app.Post("/", MyHandler) + app.Listen(":8080") +} diff --git a/adaptors/gorillamux/_example/main.go b/_examples/examples/beginner/routes-using-gorillamux/main.go similarity index 100% rename from adaptors/gorillamux/_example/main.go rename to _examples/examples/beginner/routes-using-gorillamux/main.go diff --git a/adaptors/httprouter/_example/main.go b/_examples/examples/beginner/routes-using-httprouter/main.go similarity index 100% rename from adaptors/httprouter/_example/main.go rename to _examples/examples/beginner/routes-using-httprouter/main.go diff --git a/_examples/examples/beginner/send-files/files/first.zip b/_examples/examples/beginner/send-files/files/first.zip new file mode 100644 index 0000000000000000000000000000000000000000..431fa5fdf52a1b3d2b2918e34f8ec7b232533d1b GIT binary patch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0SK*uelbOu;m0%Mgpqr>=Tym|`!nFp zP+;|gC|GVe?MhP+p7$Rxsf!ljV^De);4NS+9}6jJBY&^dR<37{mAoU9jg zAA@Pa5MzSpJb~f44*M6+9(8vST3aSQu^@@Gd#{zY`+%TWoM`PQR_SQF1$d`Hk4D$s?++9Sy6|gDC zfei*2RJmhA!dg~tmab`=%P@yDX3x{^uEzc;5@V;+zF-IX->e09<6 z7qs_yN+6F!M9v#`dwp6y$u(L+ow-q(a)H~{NW;kn;rwQAO(%&kGeVT#rJfK7x1_M^ zSR0pkkd%2KWGtw3gvd3)PIfcF1_K?5SVfOp26!#PZ2@>BJG{T(k(H(0UiKZx_yQ@N zG-lYJ4+Aj~q@$qpWzm_|%<2CFP)h*<6aW+e000O8Asu;0`xC4{9Ekt`Az=XkO#lD@ z00000001BW00000002{TVR9~4VRCaWMQ~|zZ)9aIR!K=NRA^-`MsIRsWiCN?VQXb> zb1pJ4F*PnXGB9v1LTq(XVRW0O9ci1000010097d d0001oi2wi*0C{Of literal 0 HcmV?d00001 diff --git a/_examples/examples/beginner/send-files/main.go b/_examples/examples/beginner/send-files/main.go new file mode 100644 index 00000000..454bfcbc --- /dev/null +++ b/_examples/examples/beginner/send-files/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "gopkg.in/kataras/iris.v6" + "gopkg.in/kataras/iris.v6/adaptors/httprouter" +) + +func main() { + app := iris.New() + // output startup banner and error logs on os.Stdout + app.Adapt(iris.DevLogger()) + // set the router, you can choose gorillamux too + app.Adapt(httprouter.New()) + + app.Get("/servezip", func(c *iris.Context) { + file := "./files/first.zip" + c.SendFile(file, "c.zip") + }) + + app.Listen(":8080") +} diff --git a/_examples/examples/json/main.go b/_examples/examples/beginner/write-json/main.go similarity index 100% rename from _examples/examples/json/main.go rename to _examples/examples/beginner/write-json/main.go diff --git a/_examples/examples/forms/main.go b/_examples/examples/forms/main.go deleted file mode 100644 index 0e221703..00000000 --- a/_examples/examples/forms/main.go +++ /dev/null @@ -1,47 +0,0 @@ -package main - -import ( - "gopkg.in/kataras/iris.v6" - "gopkg.in/kataras/iris.v6/adaptors/httprouter" - "gopkg.in/kataras/iris.v6/adaptors/view" -) - -// ContactDetails the information from user -type ContactDetails struct { - Email string `form:"email"` - Subject string `form:"subject"` - Message string `form:"message"` -} - -func main() { - app := iris.New() - app.Adapt(httprouter.New()) - - // Parse all files inside `./mytemplates` directory ending with `.html` - app.Adapt(view.HTML("./mytemplates", ".html")) - - app.Get("/", func(ctx *iris.Context) { - ctx.Render("forms.html", nil) - }) - - // Equivalent with app.HandleFunc("POST", ...) - app.Post("/", func(ctx *iris.Context) { - - // details := ContactDetails{ - // Email: ctx.FormValue("email"), - // Subject: ctx.FormValue("subject"), - // Message: ctx.FormValue("message"), - // } - - // or simply: - var details ContactDetails - ctx.ReadForm(&details) - - // do something with details - _ = details - - ctx.Render("forms.html", struct{ Success bool }{true}) - }) - - app.Listen(":8080") -} diff --git a/_examples/examples/forms/mytemplates/forms.html b/_examples/examples/forms/mytemplates/forms.html deleted file mode 100644 index 6044d5be..00000000 --- a/_examples/examples/forms/mytemplates/forms.html +++ /dev/null @@ -1,14 +0,0 @@ -{{if .Success}} -

Thanks for your message!

-{{else}} -

Contact

-
-
-
-
-
-
-
- -
-{{end}} diff --git a/middleware/basicauth/_example/main.go b/_examples/examples/intermediate/basicauth/main.go similarity index 100% rename from middleware/basicauth/_example/main.go rename to _examples/examples/intermediate/basicauth/main.go diff --git a/_examples/examples/cache-markdown/main.go b/_examples/examples/intermediate/cache-markdown/main.go similarity index 100% rename from _examples/examples/cache-markdown/main.go rename to _examples/examples/intermediate/cache-markdown/main.go diff --git a/adaptors/cors/_example/main.go b/_examples/examples/intermediate/cors/main.go similarity index 100% rename from adaptors/cors/_example/main.go rename to _examples/examples/intermediate/cors/main.go diff --git a/_examples/examples/intermediate/e-mail/main.go b/_examples/examples/intermediate/e-mail/main.go new file mode 100644 index 00000000..eec2bdd2 --- /dev/null +++ b/_examples/examples/intermediate/e-mail/main.go @@ -0,0 +1,77 @@ +package main + +import ( + "bytes" + + "github.com/kataras/go-mailer" + "gopkg.in/kataras/iris.v6" + "gopkg.in/kataras/iris.v6/adaptors/httprouter" +) + +func main() { + + app := iris.New() + // output startup banner and error logs on os.Stdout + app.Adapt(iris.DevLogger()) + // set the router, you can choose gorillamux too + app.Adapt(httprouter.New()) + + // change these to your own settings + cfg := mailer.Config{ + Host: "smtp.mailgun.org", + Username: "postmaster@sandbox661c307650f04e909150b37c0f3b2f09.mailgun.org", + Password: "38304272b8ee5c176d5961dc155b2417", + Port: 587, + } + // change these to your e-mail to check if that works + + // create the service + mailService := mailer.New(cfg) + + var to = []string{"kataras2006@hotmail.com"} + + // standalone + + //mailService.Send("iris e-mail test subject", "outside of context before server's listen!", to...) + + //inside handler + app.Get("/send", func(ctx *iris.Context) { + content := `

Hello From Iris web framework



This is the rich message body ` + + err := mailService.Send("iris e-mail just t3st subject", content, to...) + + if err != nil { + ctx.HTML(200, " Problem while sending the e-mail: "+err.Error()) + } else { + ctx.HTML(200, "

SUCCESS

") + } + }) + + // send a body by template + app.Get("/send/template", func(ctx *iris.Context) { + // we will not use ctx.Render + // because we don't want to render to the client + // we need the templates' parsed result as raw bytes + // so we make use of the bytes.Buffer which is an io.Writer + // which being expected on app.Render parameter first. + // + // the rest of the parameters are the same and the behavior is the same as ctx.Render, + // except the 'where to render' + buff := &bytes.Buffer{} + + app.Render(buff, "body.html", iris.Map{ + "Message": " his is the rich message body sent by a template!!", + "Footer": "The footer of this e-mail!", + }) + content := buff.String() + + err := mailService.Send("iris e-mail just t3st subject", content, to...) + + if err != nil { + ctx.HTML(iris.StatusOK, " Problem while sending the e-mail: "+err.Error()) + } else { + ctx.HTML(iris.StatusOK, "

SUCCESS

") + } + }) + app.Listen(":8080") +} diff --git a/_examples/examples/intermediate/e-mail/templates/mail_body.html b/_examples/examples/intermediate/e-mail/templates/mail_body.html new file mode 100644 index 00000000..1e59b733 --- /dev/null +++ b/_examples/examples/intermediate/e-mail/templates/mail_body.html @@ -0,0 +1,7 @@ +

Hello From Iris web framework

+
+
+ {{.Message}} +
+ + {{.Footer}} diff --git a/_examples/examples/intermediate/flash-messages/main.go b/_examples/examples/intermediate/flash-messages/main.go new file mode 100644 index 00000000..22e0f9b3 --- /dev/null +++ b/_examples/examples/intermediate/flash-messages/main.go @@ -0,0 +1,45 @@ +package main + +import ( + "gopkg.in/kataras/iris.v6" + "gopkg.in/kataras/iris.v6/adaptors/httprouter" + "gopkg.in/kataras/iris.v6/adaptors/sessions" +) + +func main() { + app := iris.New() + // output startup banner and error logs on os.Stdout + app.Adapt(iris.DevLogger()) + // set the router, you can choose gorillamux too + app.Adapt(httprouter.New()) + sess := sessions.New(sessions.Config{Cookie: "myappsessionid"}) + app.Adapt(sess) + + app.Get("/set", func(ctx *iris.Context) { + ctx.Session().SetFlash("name", "iris") + ctx.Writef("Message setted, is available for the next request") + }) + + app.Get("/get", func(ctx *iris.Context) { + name := ctx.Session().GetFlashString("name") + if name != "" { + ctx.Writef("Empty name!!") + return + } + ctx.Writef("Hello %s", name) + }) + + app.Get("/test", func(ctx *iris.Context) { + name := ctx.Session().GetFlashString("name") + if name != "" { + ctx.Writef("Empty name!!") + return + } + + ctx.Writef("Ok you are comming from /set ,the value of the name is %s", name) + ctx.Writef(", and again from the same context: %s", name) + + }) + + app.Listen(":8080") +} diff --git a/_examples/examples/intermediate/graceful-shutdown/main.go b/_examples/examples/intermediate/graceful-shutdown/main.go new file mode 100644 index 00000000..71d08a10 --- /dev/null +++ b/_examples/examples/intermediate/graceful-shutdown/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "context" + "time" + + "gopkg.in/kataras/iris.v6" + "gopkg.in/kataras/iris.v6/adaptors/httprouter" +) + +func main() { + app := iris.New() + // output startup banner and error logs on os.Stdout + app.Adapt(iris.DevLogger()) + // set the router, you can choose gorillamux too + app.Adapt(httprouter.New()) + + app.Get("/hi", func(ctx *iris.Context) { + ctx.HTML(iris.StatusOK, "

hi, I just exist in order to see if the server is closed

") + }) + + app.Adapt(iris.EventPolicy{ + // Interrupt Event means when control+C pressed on terminal. + Interrupted: func(*iris.Framework) { + // shut down gracefully, but wait 5 seconds the maximum before closed + ctx, _ := context.WithTimeout(context.Background(), 5*time.Second) + app.Shutdown(ctx) + }, + }) + + app.Listen(":8080") +} diff --git a/middleware/i18n/_example/locales/locale_el-GR.ini b/_examples/examples/intermediate/i18n/locales/locale_el-GR.ini similarity index 100% rename from middleware/i18n/_example/locales/locale_el-GR.ini rename to _examples/examples/intermediate/i18n/locales/locale_el-GR.ini diff --git a/middleware/i18n/_example/locales/locale_en-US.ini b/_examples/examples/intermediate/i18n/locales/locale_en-US.ini similarity index 100% rename from middleware/i18n/_example/locales/locale_en-US.ini rename to _examples/examples/intermediate/i18n/locales/locale_en-US.ini diff --git a/middleware/i18n/_example/locales/locale_zh-CN.ini b/_examples/examples/intermediate/i18n/locales/locale_zh-CN.ini similarity index 100% rename from middleware/i18n/_example/locales/locale_zh-CN.ini rename to _examples/examples/intermediate/i18n/locales/locale_zh-CN.ini diff --git a/middleware/i18n/_example/main.go b/_examples/examples/intermediate/i18n/main.go similarity index 100% rename from middleware/i18n/_example/main.go rename to _examples/examples/intermediate/i18n/main.go diff --git a/_examples/examples/password-hashing/main.go b/_examples/examples/intermediate/password-hashing/main.go similarity index 100% rename from _examples/examples/password-hashing/main.go rename to _examples/examples/intermediate/password-hashing/main.go diff --git a/middleware/pprof/_example/main.go b/_examples/examples/intermediate/pprof/main.go similarity index 100% rename from middleware/pprof/_example/main.go rename to _examples/examples/intermediate/pprof/main.go diff --git a/middleware/recover/_example/main.go b/_examples/examples/intermediate/recover/main.go similarity index 100% rename from middleware/recover/_example/main.go rename to _examples/examples/intermediate/recover/main.go diff --git a/middleware/logger/_example/main.go b/_examples/examples/intermediate/request-logger/main.go similarity index 100% rename from middleware/logger/_example/main.go rename to _examples/examples/intermediate/request-logger/main.go diff --git a/adaptors/sessions/_examples/database/main.go b/_examples/examples/intermediate/sessions/database/main.go similarity index 100% rename from adaptors/sessions/_examples/database/main.go rename to _examples/examples/intermediate/sessions/database/main.go diff --git a/_examples/examples/sessions/main.go b/_examples/examples/intermediate/sessions/overview/main.go similarity index 100% rename from _examples/examples/sessions/main.go rename to _examples/examples/intermediate/sessions/overview/main.go diff --git a/adaptors/sessions/_examples/securecookie/main.go b/_examples/examples/intermediate/sessions/securecookie/main.go similarity index 100% rename from adaptors/sessions/_examples/securecookie/main.go rename to _examples/examples/intermediate/sessions/securecookie/main.go diff --git a/adaptors/sessions/_examples/standalone/main.go b/_examples/examples/intermediate/sessions/standalone/main.go similarity index 100% rename from adaptors/sessions/_examples/standalone/main.go rename to _examples/examples/intermediate/sessions/standalone/main.go diff --git a/_examples/examples/upload-files/main.go b/_examples/examples/intermediate/upload-files/main.go similarity index 100% rename from _examples/examples/upload-files/main.go rename to _examples/examples/intermediate/upload-files/main.go diff --git a/_examples/examples/upload-files/templates/upload_form.html b/_examples/examples/intermediate/upload-files/templates/upload_form.html similarity index 100% rename from _examples/examples/upload-files/templates/upload_form.html rename to _examples/examples/intermediate/upload-files/templates/upload_form.html diff --git a/adaptors/view/_examples/custom_renderer/main.go b/_examples/examples/intermediate/view/custom-renderer/main.go similarity index 100% rename from adaptors/view/_examples/custom_renderer/main.go rename to _examples/examples/intermediate/view/custom-renderer/main.go diff --git a/adaptors/view/_examples/template_binary/bindata.go b/_examples/examples/intermediate/view/embedding-templates-into-app/bindata.go similarity index 100% rename from adaptors/view/_examples/template_binary/bindata.go rename to _examples/examples/intermediate/view/embedding-templates-into-app/bindata.go diff --git a/adaptors/view/_examples/template_binary/main.go b/_examples/examples/intermediate/view/embedding-templates-into-app/main.go similarity index 100% rename from adaptors/view/_examples/template_binary/main.go rename to _examples/examples/intermediate/view/embedding-templates-into-app/main.go diff --git a/adaptors/view/_examples/template_binary/templates/hi.html b/_examples/examples/intermediate/view/embedding-templates-into-app/templates/hi.html similarity index 100% rename from adaptors/view/_examples/template_binary/templates/hi.html rename to _examples/examples/intermediate/view/embedding-templates-into-app/templates/hi.html diff --git a/adaptors/view/_examples/overview/main.go b/_examples/examples/intermediate/view/overview/main.go similarity index 100% rename from adaptors/view/_examples/overview/main.go rename to _examples/examples/intermediate/view/overview/main.go diff --git a/adaptors/view/_examples/overview/templates/hi.html b/_examples/examples/intermediate/view/overview/templates/hi.html similarity index 100% rename from adaptors/view/_examples/overview/templates/hi.html rename to _examples/examples/intermediate/view/overview/templates/hi.html diff --git a/adaptors/view/_examples/template_html_0/main.go b/_examples/examples/intermediate/view/template_html_0/main.go similarity index 100% rename from adaptors/view/_examples/template_html_0/main.go rename to _examples/examples/intermediate/view/template_html_0/main.go diff --git a/adaptors/view/_examples/template_html_0/templates/hi.html b/_examples/examples/intermediate/view/template_html_0/templates/hi.html similarity index 100% rename from adaptors/view/_examples/template_html_0/templates/hi.html rename to _examples/examples/intermediate/view/template_html_0/templates/hi.html diff --git a/adaptors/view/_examples/template_html_1/main.go b/_examples/examples/intermediate/view/template_html_1/main.go similarity index 100% rename from adaptors/view/_examples/template_html_1/main.go rename to _examples/examples/intermediate/view/template_html_1/main.go diff --git a/adaptors/view/_examples/template_html_1/templates/layout.html b/_examples/examples/intermediate/view/template_html_1/templates/layout.html similarity index 100% rename from adaptors/view/_examples/template_html_1/templates/layout.html rename to _examples/examples/intermediate/view/template_html_1/templates/layout.html diff --git a/adaptors/view/_examples/template_html_1/templates/mypage.html b/_examples/examples/intermediate/view/template_html_1/templates/mypage.html similarity index 100% rename from adaptors/view/_examples/template_html_1/templates/mypage.html rename to _examples/examples/intermediate/view/template_html_1/templates/mypage.html diff --git a/adaptors/view/_examples/template_html_2/README.md b/_examples/examples/intermediate/view/template_html_2/README.md similarity index 100% rename from adaptors/view/_examples/template_html_2/README.md rename to _examples/examples/intermediate/view/template_html_2/README.md diff --git a/adaptors/view/_examples/template_html_2/main.go b/_examples/examples/intermediate/view/template_html_2/main.go similarity index 100% rename from adaptors/view/_examples/template_html_2/main.go rename to _examples/examples/intermediate/view/template_html_2/main.go diff --git a/adaptors/view/_examples/template_html_2/templates/layouts/layout.html b/_examples/examples/intermediate/view/template_html_2/templates/layouts/layout.html similarity index 100% rename from adaptors/view/_examples/template_html_2/templates/layouts/layout.html rename to _examples/examples/intermediate/view/template_html_2/templates/layouts/layout.html diff --git a/adaptors/view/_examples/template_html_2/templates/layouts/mylayout.html b/_examples/examples/intermediate/view/template_html_2/templates/layouts/mylayout.html similarity index 100% rename from adaptors/view/_examples/template_html_2/templates/layouts/mylayout.html rename to _examples/examples/intermediate/view/template_html_2/templates/layouts/mylayout.html diff --git a/adaptors/view/_examples/template_html_2/templates/page1.html b/_examples/examples/intermediate/view/template_html_2/templates/page1.html similarity index 100% rename from adaptors/view/_examples/template_html_2/templates/page1.html rename to _examples/examples/intermediate/view/template_html_2/templates/page1.html diff --git a/adaptors/view/_examples/template_html_2/templates/partials/page1_partial1.html b/_examples/examples/intermediate/view/template_html_2/templates/partials/page1_partial1.html similarity index 100% rename from adaptors/view/_examples/template_html_2/templates/partials/page1_partial1.html rename to _examples/examples/intermediate/view/template_html_2/templates/partials/page1_partial1.html diff --git a/adaptors/view/_examples/template_html_3/main.go b/_examples/examples/intermediate/view/template_html_3/main.go similarity index 100% rename from adaptors/view/_examples/template_html_3/main.go rename to _examples/examples/intermediate/view/template_html_3/main.go diff --git a/adaptors/view/_examples/template_html_3/templates/page.html b/_examples/examples/intermediate/view/template_html_3/templates/page.html similarity index 100% rename from adaptors/view/_examples/template_html_3/templates/page.html rename to _examples/examples/intermediate/view/template_html_3/templates/page.html diff --git a/adaptors/view/_examples/template_html_4/hosts b/_examples/examples/intermediate/view/template_html_4/hosts similarity index 100% rename from adaptors/view/_examples/template_html_4/hosts rename to _examples/examples/intermediate/view/template_html_4/hosts diff --git a/adaptors/view/_examples/template_html_4/main.go b/_examples/examples/intermediate/view/template_html_4/main.go similarity index 100% rename from adaptors/view/_examples/template_html_4/main.go rename to _examples/examples/intermediate/view/template_html_4/main.go diff --git a/adaptors/view/_examples/template_html_4/templates/page.html b/_examples/examples/intermediate/view/template_html_4/templates/page.html similarity index 100% rename from adaptors/view/_examples/template_html_4/templates/page.html rename to _examples/examples/intermediate/view/template_html_4/templates/page.html diff --git a/adaptors/websocket/_examples/websocket_connectionlist/main.go b/_examples/examples/intermediate/websockets/connectionlist/main.go similarity index 100% rename from adaptors/websocket/_examples/websocket_connectionlist/main.go rename to _examples/examples/intermediate/websockets/connectionlist/main.go diff --git a/adaptors/websocket/_examples/websocket/static/js/chat.js b/_examples/examples/intermediate/websockets/connectionlist/static/js/chat.js similarity index 100% rename from adaptors/websocket/_examples/websocket/static/js/chat.js rename to _examples/examples/intermediate/websockets/connectionlist/static/js/chat.js diff --git a/adaptors/websocket/_examples/websocket/templates/client.html b/_examples/examples/intermediate/websockets/connectionlist/templates/client.html similarity index 100% rename from adaptors/websocket/_examples/websocket/templates/client.html rename to _examples/examples/intermediate/websockets/connectionlist/templates/client.html diff --git a/adaptors/websocket/_examples/websocket_custom_go_client/main.go b/_examples/examples/intermediate/websockets/custom-go-client/main.go similarity index 100% rename from adaptors/websocket/_examples/websocket_custom_go_client/main.go rename to _examples/examples/intermediate/websockets/custom-go-client/main.go diff --git a/adaptors/websocket/_examples/websocket_native_messages/main.go b/_examples/examples/intermediate/websockets/native-messages/main.go similarity index 100% rename from adaptors/websocket/_examples/websocket_native_messages/main.go rename to _examples/examples/intermediate/websockets/native-messages/main.go diff --git a/adaptors/websocket/_examples/websocket_native_messages/static/js/chat.js b/_examples/examples/intermediate/websockets/native-messages/static/js/chat.js similarity index 100% rename from adaptors/websocket/_examples/websocket_native_messages/static/js/chat.js rename to _examples/examples/intermediate/websockets/native-messages/static/js/chat.js diff --git a/adaptors/websocket/_examples/websocket_native_messages/templates/client.html b/_examples/examples/intermediate/websockets/native-messages/templates/client.html similarity index 100% rename from adaptors/websocket/_examples/websocket_native_messages/templates/client.html rename to _examples/examples/intermediate/websockets/native-messages/templates/client.html diff --git a/adaptors/websocket/_examples/websocket/main.go b/_examples/examples/intermediate/websockets/overview/main.go similarity index 100% rename from adaptors/websocket/_examples/websocket/main.go rename to _examples/examples/intermediate/websockets/overview/main.go diff --git a/adaptors/websocket/_examples/websocket_connectionlist/static/js/chat.js b/_examples/examples/intermediate/websockets/overview/static/js/chat.js similarity index 100% rename from adaptors/websocket/_examples/websocket_connectionlist/static/js/chat.js rename to _examples/examples/intermediate/websockets/overview/static/js/chat.js diff --git a/adaptors/websocket/_examples/websocket_connectionlist/templates/client.html b/_examples/examples/intermediate/websockets/overview/templates/client.html similarity index 100% rename from adaptors/websocket/_examples/websocket_connectionlist/templates/client.html rename to _examples/examples/intermediate/websockets/overview/templates/client.html diff --git a/_examples/examples/websockets/main.go b/_examples/examples/intermediate/websockets/ridiculous-simple/main.go similarity index 100% rename from _examples/examples/websockets/main.go rename to _examples/examples/intermediate/websockets/ridiculous-simple/main.go diff --git a/_examples/examples/websockets/websockets.html b/_examples/examples/intermediate/websockets/ridiculous-simple/websockets.html similarity index 100% rename from _examples/examples/websockets/websockets.html rename to _examples/examples/intermediate/websockets/ridiculous-simple/websockets.html diff --git a/adaptors/websocket/_examples/websocket_secure/main.go b/_examples/examples/intermediate/websockets/secure/main.go similarity index 100% rename from adaptors/websocket/_examples/websocket_secure/main.go rename to _examples/examples/intermediate/websockets/secure/main.go diff --git a/adaptors/websocket/_examples/websocket_secure/static/js/chat.js b/_examples/examples/intermediate/websockets/secure/static/js/chat.js similarity index 100% rename from adaptors/websocket/_examples/websocket_secure/static/js/chat.js rename to _examples/examples/intermediate/websockets/secure/static/js/chat.js diff --git a/adaptors/websocket/_examples/websocket_secure/templates/client.html b/_examples/examples/intermediate/websockets/secure/templates/client.html similarity index 100% rename from adaptors/websocket/_examples/websocket_secure/templates/client.html rename to _examples/examples/intermediate/websockets/secure/templates/client.html diff --git a/_examples/examples/routes-using-gorillamux/main.go b/_examples/examples/routes-using-gorillamux/main.go deleted file mode 100644 index 5c10b983..00000000 --- a/_examples/examples/routes-using-gorillamux/main.go +++ /dev/null @@ -1,28 +0,0 @@ -package main - -import ( - "gopkg.in/kataras/iris.v6" - "gopkg.in/kataras/iris.v6/adaptors/gorillamux" -) - -func main() { - app := iris.New() - // Adapt the "httprouter", you can use "gorillamux" too. - app.Adapt(gorillamux.New()) - - userAges := map[string]int{ - "Alice": 25, - "Bob": 30, - "Claire": 29, - } - - // Equivalent with app.HandleFunc("GET", ...) - app.Get("/users/{name}", func(ctx *iris.Context) { - name := ctx.Param("name") - age := userAges[name] - - ctx.Writef("%s is %d years old!", name, age) - }) - - app.Listen(":8080") -} diff --git a/_examples/examples/routes-using-httprouter/main.go b/_examples/examples/routes-using-httprouter/main.go deleted file mode 100644 index 78b39137..00000000 --- a/_examples/examples/routes-using-httprouter/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "gopkg.in/kataras/iris.v6" - "gopkg.in/kataras/iris.v6/adaptors/httprouter" -) - -func main() { - app := iris.New() - app.Adapt(httprouter.New()) - - userAges := map[string]int{ - "Alice": 25, - "Bob": 30, - "Claire": 29, - } - - // Equivalent with app.HandleFunc("GET", ...) - app.Get("/users/:name", func(ctx *iris.Context) { - name := ctx.Param("name") - age := userAges[name] - - ctx.Writef("%s is %d years old!", name, age) - }) - - app.Listen(":8080") -} diff --git a/_examples/examples/templates/main.go b/_examples/examples/templates/main.go deleted file mode 100644 index 297eb67e..00000000 --- a/_examples/examples/templates/main.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "gopkg.in/kataras/iris.v6" - "gopkg.in/kataras/iris.v6/adaptors/httprouter" - "gopkg.in/kataras/iris.v6/adaptors/view" -) - -// Todo bind struct -type Todo struct { - Task string - Done bool -} - -func main() { - // Configuration is optional - app := iris.New(iris.Configuration{Gzip: false, Charset: "UTF-8"}) - - // Adapt a logger which will print all errors to os.Stdout - app.Adapt(iris.DevLogger()) - - // Adapt the httprouter (we will use that on all examples) - app.Adapt(httprouter.New()) - - // Parse all files inside `./mytemplates` directory ending with `.html` - app.Adapt(view.HTML("./mytemplates", ".html")) - - todos := []Todo{ - {"Learn Go", true}, - {"Read GopherBOOk", true}, - {"Create a web app in Go", false}, - } - - app.Get("/", func(ctx *iris.Context) { - ctx.Render("todos.html", struct{ Todos []Todo }{todos}) - }) - - app.Listen(":8080") -} diff --git a/_examples/examples/templates/mytemplates/todos.html b/_examples/examples/templates/mytemplates/todos.html deleted file mode 100644 index a602ed70..00000000 --- a/_examples/examples/templates/mytemplates/todos.html +++ /dev/null @@ -1,10 +0,0 @@ -

Todos

-
    - {{range .Todos}} - {{if .Done}} -
  • {{.Task}}
  • - {{else}} -
  • {{.Task}}
  • - {{end}} - {{end}} -
diff --git a/doc.go b/doc.go index d2fc69f4..98fe9b8a 100644 --- a/doc.go +++ b/doc.go @@ -605,7 +605,7 @@ Example code: djangoEngine.Binary(asset, assetNames) app.Adapt(djangoEngine) -A real example can be found here: https://github.com/kataras/iris/tree/v6/adaptors/view/_examples/template_binary . +A real example can be found here: https://github.com/kataras/iris/tree/v6/_examples/intermediate/view/embedding-templates-into-app. Enable auto-reloading of templates on each request. Useful while developers are in dev mode as they no neeed to restart their app on every template edit.