Skip to content

How to exclude the specified directory using SPA #1870

@aadog

Description

@aadog

Describe the issue you are facing or ask for help


	app := iris.New().Configure(iris.WithLowercaseRouting)

	// Serve our front-end and its assets.
	app.HandleDir("/", iris.Dir("./app/public"), iris.DirOptions{
		SPA:       true,
		IndexName: "index.html",
	})
	sess := sessions.New(sessions.Config{Cookie: "sessionId"})
	sess.UseDatabase(sessionDB)
	app.Use(sess.Handler())
	app.Use(antd.NewSessionAuth(enforcer).Handler())

	app.PartyFunc("/api", func(api router.Party) {
		mvc.New(api.Party("/shopee")).Handle(&controllers.Shopee{}).HandleError(antd.HandlerError)

		mvc.New(api.Party("/addresss")).Handle(&controllers.Addresss{}).HandleError(antd.HandlerError)
	}).OnAnyErrorCode(func(c *context.Context) {
		fmt.Println("xxx")
	})
	app.Listen(":8080")

/api

/How the API handles its own 404 errors,
Or use spa to exclude the / API directory, at least when 404 occurs, and skip cache

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions