forked from kataras/iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (33 loc) · 961 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"gopkg.in/kataras/iris.v6"
"gopkg.in/kataras/iris.v6/adaptors/httprouter"
)
func main() {
app := iris.New()
app.Adapt(iris.DevLogger())
// subdomains works with all available routers, like other features too.
app.Adapt(httprouter.New())
/*
* Setup static files
*/
app.StaticWeb("/assets", "./public/assets")
app.StaticWeb("/upload_resources", "./public/upload_resources")
dashboard := app.Party("dashboard.")
{
dashboard.Get("/", func(ctx *iris.Context) {
ctx.Writef("HEY FROM dashboard")
})
}
system := app.Party("system.")
{
system.Get("/", func(ctx *iris.Context) {
ctx.Writef("HEY FROM system")
})
}
app.Get("/", func(ctx *iris.Context) {
ctx.Writef("HEY FROM frontend /")
})
/* test this on firefox, because the domain is not real (because of .local), on firefox this will fail, but you can test it with other domain */
app.Listen("domain.local:80") // for beginners: look ../hosts file
}