1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-30 00:07:04 +00:00

create the new FileServer and HandleDir, deprecate the rest APIBuilder/Party static methods and more

relative: https://github.com/kataras/iris/issues/1283 and removing pongo2 from vendor: https://github.com/kataras/iris/issues/1284

Former-commit-id: 3ec57b349f99faca2b8e36d9f7252db0b6ea080d
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-06-21 19:43:25 +03:00
parent 7f9e33cabb
commit d0104defa8
72 changed files with 1585 additions and 1826 deletions

View File

@@ -101,7 +101,7 @@ func main() {
app.RegisterView(iris.HTML("./views", ".html"))
// Make the /public route path to statically serve the ./public/... contents
app.StaticWeb("/public", "./public")
app.HandleDir("/public", "./public")
// Render the actual form
// GET: http://localhost:8080

View File

@@ -168,7 +168,7 @@ func main() {
app := iris.New()
app.RegisterView(iris.HTML("./views", ".html"))
app.StaticWeb("/public", "./public")
app.HandleDir("/public", "./public")
app.Get("/", func(ctx iris.Context) {
ctx.View("upload.html")

View File

@@ -124,7 +124,7 @@ func main() {
app := iris.New()
app.RegisterView(iris.HTML("./views", ".html"))
app.StaticWeb("/public", "./public")
app.HandleDir("/public", "./public")
app.Get("/", func(ctx iris.Context) {
ctx.View("upload.html")

View File

@@ -8,7 +8,7 @@ Article is coming soon, follow and stay tuned
Read [the fully functional example](main.go).
```sh
$ go get -u github.com/mongodb/mongo-go-driver
$ go get -u go.mongodb.org/mongo-driver/...
$ go get -u github.com/joho/godotenv
```

View File

@@ -1,6 +1,6 @@
package main
// go get -u github.com/mongodb/mongo-go-driver
// go get -u go.mongodb.org/mongo-driver
// go get -u github.com/joho/godotenv
import (
@@ -19,7 +19,7 @@ import (
"github.com/kataras/iris"
"github.com/mongodb/mongo-go-driver/mongo"
"go.mongodb.org/mongo-driver/mongo"
)
const version = "0.0.1"

View File

@@ -4,11 +4,11 @@ import (
"context"
"errors"
"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/bson/primitive"
"github.com/mongodb/mongo-go-driver/mongo"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
// up to you:
// "github.com/mongodb/mongo-go-driver/mongo/options"
// "go.mongodb.org/mongo-driver/mongo/options"
)
type Movie struct {

View File

@@ -23,7 +23,7 @@ func main() {
app.Any("/iris-ws.js", websocket.ClientHandler())
// register static assets request path and system directory
app.StaticWeb("/js", "./static/assets/js")
app.HandleDir("/js", "./static/assets/js")
h := func(ctx iris.Context) {
ctx.ViewData("", page{PageID: "index page"})

View File

@@ -49,7 +49,7 @@ func newApp(db *DB) *iris.Application {
app.RegisterView(tmpl)
// Serve static files (css)
app.StaticWeb("/static", "./resources")
app.HandleDir("/static", "./resources")
indexHandler := func(ctx iris.Context) {
ctx.ViewData("URL_COUNT", db.Len())

View File

@@ -500,7 +500,7 @@ func main() {
// no need for any server-side template here,
// actually if you're going to just use vue without any
// back-end services, you can just stop afer this line and start the server.
app.StaticWeb("/", "./public")
app.HandleDir("/", "./public")
// configure the http sessions.
sess := sessions.New(sessions.Config{

View File

@@ -19,7 +19,7 @@ func main() {
// no need for any server-side template here,
// actually if you're going to just use vue without any
// back-end services, you can just stop afer this line and start the server.
app.StaticWeb("/", "./public")
app.HandleDir("/", "./public")
// configure the http sessions.
sess := sessions.New(sessions.Config{