mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
33 lines
761 B
Go
33 lines
761 B
Go
// Package main simply shows how you can getting started with Iris and Vue Router.
|
|
// Read more at: https://router.vuejs.org/guide/#html
|
|
package main
|
|
|
|
import "github.com/kataras/iris/v12"
|
|
|
|
func main() {
|
|
app := iris.New()
|
|
app.HandleDir("/", "./frontend")
|
|
|
|
app.Listen(":8080")
|
|
}
|
|
|
|
/* For those who want to use HTML template as the index page
|
|
and serve static files in the root request path
|
|
and use vue router as the main router of the entire application,
|
|
please follow the below code example:
|
|
|
|
func fullVueRouter() {
|
|
app := iris.New()
|
|
app.RegisterView(iris.HTML("./views", ".html"))
|
|
app.OnAnyErrorCode(index)
|
|
app.HandleDir("/", "./frontend")
|
|
app.Get("/", index)
|
|
|
|
app.Listen(":8080")
|
|
}
|
|
|
|
func index(ctx iris.Context) {
|
|
ctx.View("index.html")
|
|
}
|
|
*/
|