├── .gitignore
├── LICENSE
├── README.md
├── domain-subdomain
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ ├── admin
│ │ │ └── app.go
│ │ ├── app.go
│ │ └── wildcard
│ │ │ └── app.go
│ ├── init.go
│ └── models
│ │ └── greet.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
├── go.mod
├── i18n
│ └── messages.en
├── static
│ ├── css
│ │ └── aah.css
│ ├── img
│ │ ├── aah-framework-logo.png
│ │ └── favicon.ico
│ ├── js
│ │ └── aah.js
│ └── robots.txt
└── views
│ ├── common
│ ├── error_footer.html
│ ├── error_header.html
│ ├── footer_scripts.html
│ └── head_tags.html
│ ├── errors
│ ├── 404.html
│ └── 500.html
│ ├── layouts
│ └── master.html
│ └── pages
│ ├── admin
│ └── app
│ │ └── dashboard.html
│ ├── app
│ └── index.html
│ └── wildcard
│ └── app
│ └── entry.html
├── form-based-auth
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ ├── admin
│ │ │ └── dashboard.go
│ │ └── app.go
│ ├── init.go
│ ├── models
│ │ ├── greet.go
│ │ └── user.go
│ └── security
│ │ ├── form_authentication_provider.go
│ │ └── form_authorization_provider.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
├── go.mod
├── i18n
│ └── messages.en
├── static
│ ├── css
│ │ └── aah.css
│ ├── img
│ │ ├── aah-framework-logo.png
│ │ └── favicon.ico
│ ├── js
│ │ └── aah.js
│ └── robots.txt
└── views
│ ├── common
│ ├── error_footer.html
│ ├── error_header.html
│ ├── footer_scripts.html
│ └── head_tags.html
│ ├── errors
│ ├── 404.html
│ └── 500.html
│ ├── layouts
│ └── master.html
│ └── pages
│ ├── access-denied.html
│ ├── admin
│ └── dashboard
│ │ └── index.html
│ └── app
│ ├── index.html
│ ├── login.html
│ └── manageusers.html
├── form-fileupload
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ └── app.go
│ ├── init.go
│ ├── models
│ │ └── greet.go
│ └── util
│ │ └── util.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
├── go.mod
├── i18n
│ └── messages.en
├── static
│ ├── css
│ │ └── aah.css
│ ├── img
│ │ ├── aah-framework-logo.png
│ │ └── favicon.ico
│ ├── js
│ │ └── aah.js
│ └── robots.txt
└── views
│ ├── common
│ ├── error_footer.html
│ ├── error_header.html
│ ├── footer_scripts.html
│ └── head_tags.html
│ ├── errors
│ ├── 404.html
│ └── 500.html
│ ├── layouts
│ └── master.html
│ └── pages
│ └── app
│ ├── fileupload.html
│ └── index.html
├── form
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ └── app.go
│ ├── init.go
│ └── models
│ │ ├── greet.go
│ │ └── user.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
├── go.mod
├── i18n
│ └── messages.en
├── static
│ ├── css
│ │ └── aah.css
│ ├── img
│ │ ├── aah-framework-logo.png
│ │ └── favicon.ico
│ ├── js
│ │ └── aah.js
│ └── robots.txt
└── views
│ ├── common
│ ├── error_footer.html
│ ├── error_header.html
│ ├── footer_scripts.html
│ └── head_tags.html
│ ├── errors
│ ├── 404.html
│ └── 500.html
│ ├── layouts
│ └── master.html
│ └── pages
│ └── app
│ ├── index.html
│ └── userprofile.html
├── i18n-url-path-param
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ └── app.go
│ └── init.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
├── go.mod
├── i18n
│ ├── messages.de-DE
│ ├── messages.en
│ ├── messages.es-ES
│ ├── messages.es-MX
│ ├── messages.ja
│ └── messages.zh-CN
├── static
│ ├── css
│ │ └── aah.css
│ ├── img
│ │ ├── aah-framework-logo.png
│ │ └── favicon.ico
│ ├── js
│ │ └── aah.js
│ └── robots.txt
└── views
│ ├── common
│ ├── error_footer.html
│ ├── error_header.html
│ ├── footer_scripts.html
│ └── head_tags.html
│ ├── errors
│ ├── 404.html
│ └── 500.html
│ ├── layouts
│ └── master.html
│ └── pages
│ └── app
│ └── index.html
├── i18n-url-query-param
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ └── app.go
│ └── init.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
├── go.mod
├── i18n
│ ├── messages.de-DE
│ ├── messages.en
│ ├── messages.es-ES
│ ├── messages.es-MX
│ ├── messages.ja
│ └── messages.zh-CN
├── static
│ ├── css
│ │ └── aah.css
│ ├── img
│ │ ├── aah-framework-logo.png
│ │ └── favicon.ico
│ ├── js
│ │ └── aah.js
│ └── robots.txt
└── views
│ ├── common
│ ├── error_footer.html
│ ├── error_header.html
│ ├── footer_scripts.html
│ └── head_tags.html
│ ├── errors
│ ├── 404.html
│ └── 500.html
│ ├── layouts
│ └── master.html
│ └── pages
│ └── app
│ └── index.html
├── oauth2-social-login
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ └── app.go
│ ├── init.go
│ ├── models
│ │ └── greet.go
│ └── security
│ │ ├── authorization_provider.go
│ │ ├── facebook
│ │ └── subject_principal_provider.go
│ │ ├── github
│ │ └── subject_principal_provider.go
│ │ ├── google
│ │ └── subject_principal_provider.go
│ │ └── post_auth_event.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
├── go.mod
├── i18n
│ └── messages.en
├── static
│ ├── css
│ │ └── aah.css
│ ├── img
│ │ ├── aah-framework-logo.png
│ │ └── favicon.ico
│ ├── js
│ │ └── aah.js
│ └── robots.txt
└── views
│ ├── common
│ ├── error_footer.html
│ ├── error_header.html
│ ├── footer_scripts.html
│ └── head_tags.html
│ ├── errors
│ ├── 404.html
│ └── 500.html
│ ├── layouts
│ └── master.html
│ └── pages
│ └── app
│ ├── index.html
│ └── success.html
├── rest-api-basic-auth
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ ├── app.go
│ │ └── info.go
│ ├── init.go
│ ├── models
│ │ ├── greet.go
│ │ └── user.go
│ └── security
│ │ ├── basic_authentication_provider.go
│ │ └── basic_authorization_provider.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
└── go.mod
├── rest-api-jwt-auth
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ ├── app.go
│ │ └── info.go
│ ├── init.go
│ ├── models
│ │ ├── greet.go
│ │ └── user.go
│ └── security
│ │ ├── authentication_provider.go
│ │ ├── authorization_provider.go
│ │ └── jwt.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
└── go.mod
├── rest-api
├── .gitignore
├── README.md
├── aah.project
├── app
│ ├── controllers
│ │ ├── app.go
│ │ └── post.go
│ ├── init.go
│ └── models
│ │ ├── greet.go
│ │ └── post.go
├── config
│ ├── aah.conf
│ ├── env
│ │ ├── dev.conf
│ │ └── prod.conf
│ ├── routes.conf
│ └── security.conf
└── go.mod
└── simple-chat
├── .gitignore
├── README.md
├── aah.project
├── app
├── controllers
│ └── app.go
├── init.go
└── websockets
│ ├── event.go
│ └── simple_chat.go
├── config
├── aah.conf
├── env
│ ├── dev.conf
│ └── prod.conf
├── routes.conf
└── security.conf
├── go.mod
├── i18n
└── messages.en
├── static
├── css
│ └── aah.css
├── img
│ ├── aah-framework-logo.png
│ ├── aah-logo-64x64.png
│ └── favicon.ico
├── js
│ └── aah.js
└── robots.txt
└── views
├── common
├── error_footer.html
├── error_header.html
├── footer_scripts.html
└── head_tags.html
├── errors
├── 404.html
└── 500.html
├── layouts
└── master.html
└── pages
└── app
├── index.html
└── simplechatdemo.html
/.gitignore:
--------------------------------------------------------------------------------
1 | # .gitignore config
2 |
3 | go.sum
4 | *.pid
5 |
6 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
7 | *.o
8 | *.a
9 | *.so
10 |
11 | # Folders
12 | _obj
13 | _test
14 |
15 | # Architecture specific extensions/prefixes
16 | *.[568vq]
17 | [568vq].out
18 |
19 | *.cgo1.go
20 | *.cgo2.c
21 | _cgo_defun.c
22 | _cgo_gotypes.go
23 | _cgo_export.*
24 |
25 | _testmain.go
26 |
27 | *.exe
28 | *.test
29 | *.prof
30 |
31 | # Binaries for programs and plugins
32 | *.exe
33 | *.dll
34 | *.so
35 | *.dylib
36 |
37 | # Test binary, build with `go test -c`
38 | *.test
39 |
40 | # Output of the go coverage tool, specifically when used with LiteIDE
41 | *.out
42 |
43 | # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
44 | .glide/
45 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Jeevanandam M., https://github.com/jeevatkm, jeeva@myjeeva.com
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Examples of aah Go web framework
4 |
5 |
6 |

7 |
8 |
9 |
10 | aah examples is organized & structured version wise branch vMajorVersion.MinorVersion.x
, get into respective branch as required.
E.g. v0.7.x
, v0.8.x
, and so on.
11 |
12 |
--------------------------------------------------------------------------------
/domain-subdomain/.gitignore:
--------------------------------------------------------------------------------
1 | # aah framework application - .gitignore
2 |
3 | aah.go
4 | *.pid
5 | build/
6 | aah_*_vfs.go
7 | app/generated
8 | vendor/*/
9 | # aah application - end
10 |
11 | # Compiled Object files, Static and Dynamic libs (Shared Objects)
12 | *.o
13 | *.a
14 | *.so
15 |
16 | # Folders
17 | _obj
18 | _test
19 |
20 | # Architecture specific extensions/prefixes
21 | *.[568vq]
22 | [568vq].out
23 |
24 | *.cgo1.go
25 | *.cgo2.c
26 | _cgo_defun.c
27 | _cgo_gotypes.go
28 | _cgo_export.*
29 |
30 | _testmain.go
31 |
32 | *.exe
33 | *.test
34 | *.prof
35 |
--------------------------------------------------------------------------------
/domain-subdomain/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Example - Domain, Subdomain and Wildcard Subdomain
4 |
5 |
6 | This example application gives insights on how to use domains, subdomains and wildcard subdomains with aah framework. Reference to [Routes Config](https://docs.aahframework.org/routing.html).
7 |
8 | ### Get aah examples
9 |
10 | ```bash
11 | git clone https://github.com/go-aah/examples.git aah-examples
12 | ```
13 |
14 | ### Configure local DNS mapping
15 |
16 | Firstly, configure `hosts` file. The purpose is to do local DNS mapping for `sample.com`. This step is not applicable for production. Typically, these settings happen in domain DNS manager. Learn more about [Wildcard DNS - wikipedia](https://en.wikipedia.org/wiki/Wildcard_DNS_record)
17 |
18 | This [rackspace article](https://support.rackspace.com/how-to/modify-your-hosts-file/) covers the steps to modify-your-hosts-file for Mac, Linux and Windows.
19 |
20 | ```bash
21 | 127.0.0.1 sample.com admin.sample.com username1.sample.com username2.sample.com username3.sample.com
22 | ```
23 |
24 | ### Run this example
25 |
26 | ```bash
27 | cd aah-examples/domain-subdomain
28 | aah run
29 | ```
30 |
31 | ### Visit these URLs
32 |
33 | * http://sample.com:8080
34 | * http://admin.sample.com:8080
35 | * http://username1.sample.com:8080
36 | * http://username2.sample.com:8080
37 | * http://username3.sample.com:8080
38 |
39 |
--------------------------------------------------------------------------------
/domain-subdomain/app/controllers/admin/app.go:
--------------------------------------------------------------------------------
1 | package admin
2 |
3 | import "aahframe.work"
4 |
5 | // AppController is Admin App controller.
6 | type AppController struct {
7 | *aah.Context
8 | }
9 |
10 | // Dashboard method is admin dashboard page for examples.
11 | func (c *AppController) Dashboard() {
12 |
13 | c.Reply().Ok().HTML(aah.Data{
14 | "Subdomain": c.Subdomain(),
15 | "Message": "I'm in admin dashboard page",
16 | })
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/domain-subdomain/app/controllers/app.go:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import (
4 | "aahframe.work"
5 | "aahframework.org/examples/domain-subdomain/app/models"
6 | )
7 |
8 | // AppController struct application controller
9 | type AppController struct {
10 | *aah.Context
11 | }
12 |
13 | // Index method is application home page.
14 | func (c *AppController) Index() {
15 | data := aah.Data{
16 | "Greet": models.Greet{
17 | Message: "Example - Domain, Subdomain, and Wildcard Subdomain",
18 | },
19 | }
20 |
21 | c.Reply().Ok().HTML(data)
22 | }
23 |
--------------------------------------------------------------------------------
/domain-subdomain/app/controllers/wildcard/app.go:
--------------------------------------------------------------------------------
1 | package wildcard
2 |
3 | import (
4 | "aahframe.work"
5 | "aahframework.org/examples/domain-subdomain/app/controllers"
6 | )
7 |
8 | // AppController is wildcard controller.
9 | type AppController struct {
10 | controllers.AppController
11 | }
12 |
13 | // Entry method is wildcard subdomain controller for examples.
14 | func (c *AppController) Entry() {
15 |
16 | c.Reply().Ok().HTML(aah.Data{
17 | "Subdomain": c.Subdomain(),
18 | "Message": "I'm in wildcard app controller page",
19 | })
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/domain-subdomain/app/models/greet.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | // Greet holds the greeting message.
4 | type Greet struct {
5 | Message string `json:"message"`
6 | }
7 |
--------------------------------------------------------------------------------
/domain-subdomain/config/env/dev.conf:
--------------------------------------------------------------------------------
1 | # -----------------------------------------------------------------------------
2 | # Development Configuration
3 | # -----------------------------------------------------------------------------
4 |
5 | dev {
6 |
7 | # -----------------------------------------------------------------------------
8 | # Log Configuration
9 | #
10 | # Doc: https://docs.aahframework.org/logging.html
11 | # Doc: https://docs.aahframework.org/log-config.html
12 | # -----------------------------------------------------------------------------
13 | log {
14 | receiver = "console"
15 | level = "debug"
16 | format = "text"
17 | pattern = "%time:2006-01-02 15:04:05.000 %level:-5 %appname %insname %reqid %principal %message %fields"
18 | color = true
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/domain-subdomain/config/env/prod.conf:
--------------------------------------------------------------------------------
1 | # -----------------------------------------------------------------------------
2 | # Production Configuration
3 | # -----------------------------------------------------------------------------
4 |
5 | prod {
6 |
7 | # -----------------------------------------------------------------------------
8 | # Runtime configuration
9 | # Doc: https://docs.aahframework.org/app-config.html#section-runtime
10 | # -----------------------------------------------------------------------------
11 | runtime {
12 | debug {
13 | strip_src_base = true
14 | }
15 | }
16 |
17 | # -----------------------------------------------------------------------------
18 | # Log Configuration
19 | #
20 | # Doc: https://docs.aahframework.org/logging.html
21 | # Doc: https://docs.aahframework.org/log-config.html
22 | # -----------------------------------------------------------------------------
23 | log {
24 | receiver = "file"
25 | file = "domain-subdomain.log"
26 | level = "warn"
27 | format = "text"
28 | pattern = "%time:2006-01-02 15:04:05.000 %level:-5 %appname %insname %reqid %principal %message %fields"
29 | color = false
30 | rotate {
31 | policy = "daily"
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/domain-subdomain/config/security.conf:
--------------------------------------------------------------------------------
1 | # -----------------------------------------------------------------------------
2 | # domain-subdomain - Application Security Configuration
3 | #
4 | # Refer documentation to explore and customize the configurations.
5 | # Doc: https://docs.aahframework.org/security-config.html
6 | # -----------------------------------------------------------------------------
7 | security {
8 | # -----------------------------------------------------------------------------
9 | # Session configuration
10 | # HTTP state management across multiple requests.
11 | #
12 | # Doc: https://docs.aahframework.org/security-config.html#section-session
13 | # -----------------------------------------------------------------------------
14 | session {
15 | mode = "stateful"
16 | store {
17 | type = "cookie"
18 | }
19 | sign_key = "6f33a3752fca7731618b75579330a4ababa6a1769fc8f23703ebb9c71e04b674"
20 | enc_key = "856766d61c6445ed267cabfffffce27a"
21 | }
22 |
23 | # ---------------------------------------------------------------------------
24 | # HTTP Secure Header(s)
25 | # Application security headers with many safe defaults.
26 | #
27 | # Doc: https://docs.aahframework.org/security-config.html#section-http-header
28 | #
29 | # Tip: Quick way to verify secure headers - https://securityheaders.io
30 | # ---------------------------------------------------------------------------
31 | http_header {
32 | enable = true
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/domain-subdomain/go.mod:
--------------------------------------------------------------------------------
1 | module aahframework.org/examples/domain-subdomain
2 |
3 | require (
4 | aahframe.work v0.12.2
5 | aahframe.work/minify/html v0.2.0
6 | )
7 |
--------------------------------------------------------------------------------
/domain-subdomain/i18n/messages.en:
--------------------------------------------------------------------------------
1 | # ---------------------------------------------------------------------------
2 | # i18n messages for domain-subdomain application
3 | #
4 | # Doc: https://docs.aahframework.org/i18n.html
5 | # ---------------------------------------------------------------------------
6 |
7 | label {
8 | pages {
9 | app {
10 | index {
11 | title = "Example Domain, Subdomain and Wildcard Subdomain - Home | aah Go web framework"
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/domain-subdomain/static/css/aah.css:
--------------------------------------------------------------------------------
1 | /*
2 | Minimal aah framework application template CSS.
3 | Based on your need choose your CSS framework.
4 | */
5 |
6 | html {
7 | font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
8 | -webkit-text-size-adjust: 100%;
9 | -ms-text-size-adjust: 100%;
10 | }
11 |
12 | body {
13 | margin: 0;
14 | }
15 |
16 | .container {
17 | padding-right: 15px;
18 | padding-left: 15px;
19 | margin-right: auto;
20 | margin-left: auto;
21 | }
22 | @media (min-width: 992px) {
23 | .container {
24 | width: 970px;
25 | }
26 | }
27 | @media (min-width: 1200px) {
28 | .container {
29 | width: 1170px;
30 | }
31 | }
32 |
33 | .row {
34 | margin-right: -15px;
35 | margin-left: -15px;
36 | }
37 |
38 | .text-center {
39 | text-align: center;
40 | }
41 |
42 | .welcome-msg {
43 | padding-top: 30px;
44 | padding-bottom: 30px;
45 | margin-bottom: 30px;
46 | color: inherit;
47 | }
48 |
49 | .tm-25 {
50 | margin-top: 25px;
51 | }
52 |
--------------------------------------------------------------------------------
/domain-subdomain/static/img/aah-framework-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/go-aah/examples/f68c749b4625fe73e114045f3031968f61001a92/domain-subdomain/static/img/aah-framework-logo.png
--------------------------------------------------------------------------------
/domain-subdomain/static/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/go-aah/examples/f68c749b4625fe73e114045f3031968f61001a92/domain-subdomain/static/img/favicon.ico
--------------------------------------------------------------------------------
/domain-subdomain/static/js/aah.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/go-aah/examples/f68c749b4625fe73e114045f3031968f61001a92/domain-subdomain/static/js/aah.js
--------------------------------------------------------------------------------
/domain-subdomain/static/robots.txt:
--------------------------------------------------------------------------------
1 | # Prevents all robots visiting your site.
2 | User-agent: *
3 | Disallow: /
4 |
--------------------------------------------------------------------------------
/domain-subdomain/views/common/error_footer.html:
--------------------------------------------------------------------------------
1 |