Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 29 10:54

    kataras on master

    handle null sql iso8601, kitche… (compare)

  • Nov 19 12:13

    kataras on master

    add one more project structure … (compare)

  • Nov 15 13:56

    kataras on master

    update deps (compare)

  • Nov 15 13:29

    kataras on master

    minor improvements (compare)

  • Nov 06 19:05

    kataras on master

    improvements on the /x/client s… (compare)

  • Nov 06 18:26

    kataras on master

    new /x/jsonx and /x/mathx util … (compare)

  • Oct 31 13:50
    elliotcourant closed #1824
  • Oct 31 09:49

    kataras on master

    update dependencies (compare)

  • Oct 31 09:25

    kataras on master

    new /x/client sub-package (compare)

  • Oct 30 18:17
    elliotcourant review_requested #1824
  • Oct 30 18:17
    elliotcourant opened #1824
  • Oct 13 14:27

    kataras on master

    minor (compare)

  • Oct 13 13:33

    kataras on v12.2.0-alpha4

    (compare)

  • Oct 13 13:22

    kataras on master

    add new ':email' path parameter… (compare)

  • Oct 13 13:22

    kataras on master

    (compare)

  • Sep 22 12:04

    kataras on v12.2.0-alpha3

    (compare)

  • Sep 22 11:59

    kataras on master

    v12.2.0-alpha3 (compare)

  • Sep 22 11:50

    kataras on master

    minor (compare)

  • Sep 22 11:28

    kataras on master

    replace optimized json encoder … (compare)

  • Sep 14 19:10

    kataras on master

    update dependencies (compare)

刘旭
@liuxuzxx
I suddenly remembered, according to the time zone, it is late at night in the US
Mulyawan Sentosa
@mulyawansentosa
Hello
刘旭
@liuxuzxx
Hello
I am here
Gerasimos (Makis) Maropoulos
@kataras
Hello guys. Happy new year!
@liuxuzxx Yeah, you the one example we have at the iris-go.com/docs. That's fixed, thanks! The rest form file-relative examples (6+) are using the correct code.
Hello @mulyawansentosa and thanks for the donation :heart: I've added you to the iris-premium repository and the iris/premium gitter private chat room, please check your e-mails (or github/gitter notifications). Your name is also listed on iris-go.com and on our repository's README file.
刘旭
@liuxuzxx
@kataras Happy new year!
I saw it, now it's correct
Gerasimos (Makis) Maropoulos
@kataras

Hello Gophers!

A new tag pre-release of v12.2.0-alpha2 is available for you who don't like using @master :)

Massimiliano Bertinetti
@eclecticlly
👍
ndimorle
@ndimorle
Sorry to bother! I'm new to iris; I requested the PDF version of the doc to learn more about it but did'nt receive it. Can you help?
Massimiliano Bertinetti
@eclecticlly
@kataras will soon add you to the iris-premium repo
ndimorle
@ndimorle
Ok Thanks!
Gerasimos (Makis) Maropoulos
@kataras
Hello @ndimorle, sorry for the delay. You are in!
vuhoanglam
@vuhoanglam
"template 'page/sample.html' does not exist" is there anyway to handle view error right before it's occur? im writing a cms and trying use middleware to alter the view name before it's dispatch.
Massimiliano Bertinetti
@eclecticlly
Sorry. I don’t really understand what you need exactly.
Can you try to explain better what you are doing and what you need? Maybe share some code @vuhoanglam
vuhoanglam
@vuhoanglam
i mean
view will throw an error "template x does not exist" if i pass a wrong view path
i want to catch this error then fall back to a default view
the view should provide more events to subscribe to
such as: AfterParsed, BeforeDispatch, etc
Massimiliano Bertinetti
@eclecticlly

On a CMS sort of site I think you have a database entry for every pages and one or more template types associated and generated dinamically.

Another solution is to generate a static site based on Hugo and Netlify CMS, that for simple CMS is what I use today. It’s faster and simple to deploy.

vuhoanglam
@vuhoanglam
i want to create my own cms for researching purposes, and for better understanding Iris. I still think, iris should provide more built in events in the application lifecycle
Gerasimos (Makis) Maropoulos
@kataras

Hello @vuhoanglam,

The ctx.View returns an error. This error is always logged to your terminal screen (or log file) if the logger is not disabled.

If the application is running under debug log level (app.Logger().SetLevel("debug")) then the client will receive the error text too but if not (default behavior) then it just returns the error the caller, so you can catch it.

Example Code:

<!-- ./view/fallback.html -->
<h1>Fallback view of {{.ViewRequested}}</h1>
package main

import (
    "github.com/kataras/iris/v12"
)

const defaultViewName = "fallback"

func main() {
    app := iris.New()
    app.RegisterView(iris.HTML("./view", ".html"))
    app.Get("/", index)

    app.Listen(":8080")
}

func index(ctx iris.Context) {
    var viewName = "blabla"

    err := ctx.View(viewName)
    if err != nil {
        ctx.View(defaultViewName, iris.Map{
            "ViewRequested": viewName,
        })
    }
}

I assume you just want to render something as 'fallback' - that you can do already as shown above.

Now, if you are asking if you can disable this log line of "template x does not exist" then it's a different thing. We can create a config field in order to disable that message :)

Gerasimos (Makis) Maropoulos
@kataras
I can also put a feature of "fallback" view AND layouts of non-exist templates per handler or per Party and if that exists then the error log will be not shown up, otherwise it will, I think that's a better solution, do you agree?
Gerasimos (Makis) Maropoulos
@kataras
OK it's done @vuhoanglam, take a look at the example: https://github.com/kataras/iris/tree/master/_examples/view/fallback
vuhoanglam
@vuhoanglam
Amazing!! i ll send you a starbucks via donation form :D
Gerasimos (Makis) Maropoulos
@kataras
@vuhoanglam Thanks but I think you already did :)
vuhoanglam
@vuhoanglam
@kataras i want to send one more :D how can i do that
vuhoanglam
@vuhoanglam
is there a way to naming the filerouters
Gerasimos (Makis) Maropoulos
@kataras

Hello @vuhoanglam, you can do it from the donate form, from https://iris-go.com. Thanks :heart: .

Yes you can name file routers. The HandleDir method returns a slice of []*Route. Each *Route has a Name property, just modify it to your preffered onces.

frans
@dafa168
Docs : Upload files -- Single file , method: ctx.SaveFormFile(file, dest) not found ?
odiferousmint
@odiferousmint
Hello. When I build my executable and run it, it tells me I have installed an invalid version. It tells me to install it with go get -u github.com/kataras/iris/v12@latest so I ran that and it was successful. I built the executable again, re-ran, and I got the same warning/error. It asks me if I want to autofix it. I went for it, and I get [FTAL] 2021/02/05 02:18 autofix: replace import paths: open /tmp/foo/test: text file busy. test here is the executable that gave me this warning and asked me if I want to autofix. How can I fix it manually or workaround this issue?
odiferousmint
@odiferousmint
This is what I get:
$ ./test
You have installed an invalid version. Install with:
        go get -u github.com/kataras/iris/v12@latest

        If your Open Source project depends on that pre-go1.9 version please open an issue
        at https://github.com/kataras/iris/issues/new and share your repository with us,
        we will upgrade your project's code base to the latest version for free.

        If you have a commercial project that you cannot share publically, please contact with
        @kataras at https://chat.iris-go.com. Assistance will be provided to you and your colleagues
        for free.

Run autofix? (Y/n): y
[INFO] 2021/02/05 02:18 Backup </tmp/foo> to </tmp/foo_irisbckp.zip>
[INFO] 2021/02/05 02:18 Updating...
[FTAL] 2021/02/05 02:18 autofix: replace import paths: open /tmp/foo/test: text file busy
I am not entirely sure what it is trying to do with the executable or why. Is there any other way to run this autofix perhaps?
odiferousmint
@odiferousmint
Ah, I fixed it, never mind it. I just had to fix the imports.
odiferousmint
@odiferousmint

If I had

app := iris.Default()
app.StaticWeb("/css", "./website/assets/css")

then what would be its equivalent in the latest version of iris?

Massimiliano Bertinetti
@eclecticlly
Gerasimos (Makis) Maropoulos
@kataras
Hello @odiferousmint, it's actually app.HandleDir("/css", "./website/assets/css") (the first input parameter now is an interface{} which can accept string and http.FileSystem, there is a third optional parameter which is the iris.DirOptions - you can configure the static file server).
Hello @dafa168 , SaveFormFile exists. Please make sure you follow the Installation guide (go get github.com/kataras/iris/v12@master).
qilx
@qilx
Please is there any documentation for v12 version? It seems that https://www.iris-go.com/docs/ is for master branch.
qilx
@qilx
Anybody tried to write custom tag parser for pongo2 and register it in view.DjangoEngine? I have problems to write Execute(ctx, w) function.
qilx
@qilx
IT seems like view package is missing type aliases for pongo2.ExecutionContext and pongo2.TemplateWriter.
qilx
@qilx
Is it possible to disable removing of trailing slashes?
Alex Rojo
@arojoal
Hi is there a way to get the full url of a route?
I need to get the full url of a route in order to include it as a value in a response json
qilx
@qilx
I guess you can get it from c.Request().URL
tuhao1020
@tuhao1020
@arojoal if you have a query string, you can use ctx.FullRequestURI() + "?" + ctx.Request().URL.RawQuery