mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 23:40:35 +01:00
0f79728c88
Former-commit-id: 60d9b0d77693895fdfbebe83712e9cc1ee3f8f26
40 lines
976 B
Go
40 lines
976 B
Go
package main
|
|
|
|
import (
|
|
"github.com/kataras/iris/v12"
|
|
)
|
|
|
|
// Follow the steps below:
|
|
// $ go get -u github.com/go-bindata/go-bindata/...
|
|
//
|
|
// $ go-bindata -nomemcopy -prefix "../http2push/" ../http2push/assets/...
|
|
// # OR if the ./assets directory was inside this example foder:
|
|
// # go-bindata -nomemcopy ./assets/...
|
|
//
|
|
// $ go run .
|
|
// Physical files are not used, you can delete the "assets" folder and run the example.
|
|
|
|
var opts = iris.DirOptions{
|
|
IndexName: "/index.html",
|
|
PushTargets: map[string][]string{
|
|
"/": { // Relative path without route prefix.
|
|
"favicon.ico",
|
|
"js/main.js",
|
|
"css/main.css",
|
|
// ^ Relative to the index, if need absolute ones start with a slash ('/').
|
|
},
|
|
},
|
|
Compress: false,
|
|
ShowList: true,
|
|
Asset: Asset,
|
|
AssetInfo: AssetInfo,
|
|
AssetNames: AssetNames,
|
|
}
|
|
|
|
func main() {
|
|
app := iris.New()
|
|
app.HandleDir("/public", "./assets", opts)
|
|
|
|
app.Run(iris.TLS(":443", "../http2push/mycert.crt", "../http2push/mykey.key"))
|
|
}
|