mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
add example for https://github.com/kataras/iris/issues/1653
This commit is contained in:
32
_examples/file-server/spa-vue-router/main.go
Normal file
32
_examples/file-server/spa-vue-router/main.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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")
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user