How to serve /api and HTML5 SPA with Iris

589 Views Asked by At

I'm trying to get iris (http://iris-go.com) to serve both /api/ routes and host an angular SPA (in html5 mode).

package main

import (
"github.com/kataras/iris"
// "github.com/kataras/iris/utils"
// "strings"
)

func allVendorBrandLabel(c *iris.Context) {
c.WriteString("Hello, api :)")

}
func main() {

    iris.Get("/api/all", allVendorBrandLabel)
    iris.StaticWeb("/", "./www", 2)
    iris.Listen(":8080")
}

Can't get this approach to work. Has anyone gotten iris to do this?

1

There are 1 best solutions below

1
On

See the discussion answers on this topic:

https://github.com/iris-contrib/examples/issues/9