From bbf588feafc3d15992c68a583a7eb46618bf9d11 Mon Sep 17 00:00:00 2001 From: ZhiFeng Hu Date: Thu, 1 Sep 2016 14:37:18 +0800 Subject: [PATCH] Add support HTML5 history API and push state --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 99a6d0bf..605719c6 100644 --- a/README.md +++ b/README.md @@ -708,3 +708,14 @@ endless.ListenAndServe(":4242", router) An alternative to endless: * [manners](https://github.com/braintree/manners): A polite Go HTTP server that shuts down gracefully. + +#### Support HTML5 history API and pushstate + +``` + + r.NoRoute(func(c *gin.Context) { + c.File("./dist/index.html") //Path to your /index.html template + }) +``` + +This will using your /index.html template replace 404, similar as nginx rewrite rules and apache rewrite rules. \ No newline at end of file