mirror of
https://github.com/kataras/iris.git
synced 2025-12-29 07:47:22 +00:00
8.4.0 | New MVC Features | Refactor examples and godoc for go 1.9 use. Read HISTORY.md.
Former-commit-id: 90c05e743052bc3722e7fefaa0cbb0ed5153a1fb
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/context"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -14,7 +13,7 @@ func main() {
|
||||
// app.Favicon("./static/favicons/favicon.ico.ico", "/favicon_16_16.ico")
|
||||
// This will serve the ./static/favicons/favicon.ico.ico to: localhost:8080/favicon_16_16.ico
|
||||
|
||||
app.Get("/", func(ctx context.Context) {
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.HTML(`<a href="/favicon.ico"> press here to see the favicon.ico</a>.
|
||||
At some browsers like chrome, it should be visible at the top-left side of the browser's window,
|
||||
because some browsers make requests to the /favicon.ico automatically,
|
||||
|
||||
@@ -2,13 +2,12 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/context"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
||||
app.Get("/", func(ctx context.Context) {
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
file := "./files/first.zip"
|
||||
ctx.SendFile(file, "c.zip")
|
||||
})
|
||||
|
||||
@@ -2,8 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/context"
|
||||
"github.com/kataras/iris/view"
|
||||
)
|
||||
|
||||
// same as embedded-single-page-application but without go-bindata, the files are "physical" stored in the
|
||||
@@ -15,15 +13,15 @@ var page = struct {
|
||||
|
||||
func newApp() *iris.Application {
|
||||
app := iris.New()
|
||||
app.RegisterView(view.HTML("./public", ".html"))
|
||||
app.RegisterView(iris.HTML("./public", ".html"))
|
||||
|
||||
app.Get("/", func(ctx context.Context) {
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.ViewData("Page", page)
|
||||
ctx.View("index.html")
|
||||
})
|
||||
|
||||
// or just serve index.html as it is:
|
||||
// app.Get("/", func(ctx context.Context) {
|
||||
// app.Get("/", func(ctx iris.Context) {
|
||||
// ctx.ServeFile("index.html", false)
|
||||
// })
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/context"
|
||||
"github.com/kataras/iris/view"
|
||||
)
|
||||
|
||||
// $ go get -u github.com/jteeuwen/go-bindata/...
|
||||
@@ -17,9 +15,9 @@ var page = struct {
|
||||
|
||||
func newApp() *iris.Application {
|
||||
app := iris.New()
|
||||
app.RegisterView(view.HTML("./public", ".html").Binary(Asset, AssetNames))
|
||||
app.RegisterView(iris.HTML("./public", ".html").Binary(Asset, AssetNames))
|
||||
|
||||
app.Get("/", func(ctx context.Context) {
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.ViewData("Page", page)
|
||||
ctx.View("index.html")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user