by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 19:28

    kataras on master

    New 'Application.UseRouter(...H… (compare)

  • 17:28

    kataras on master

    important (compare)

  • 17:23

    kataras on master

    important (compare)

  • 02:46

    kataras on master

    comment fix as reported at #1574 (compare)

  • Aug 06 00:36

    kataras on master

    various improvements and new 'U… (compare)

  • Aug 05 16:35

    kataras on master

    Ability to register a view engi… (compare)

  • Aug 05 03:46

    kataras on master

    add 'iris.Blocks' template engi… (compare)

  • Aug 03 02:46

    kataras on master

    add 'iris.Ace' template engine:… (compare)

  • Aug 02 18:23

    kataras on master

    add a raw gorilla websocket exa… (compare)

  • Aug 01 02:11

    kataras on master

    minor, see prev commit (compare)

  • Aug 01 00:48

    kataras on master

    add database/orm/reform example (compare)

  • Jul 30 17:14

    kataras on master

    fix: ctx.Record and then iris.C… (compare)

  • Jul 28 10:57

    kataras on master

    README: minor (compare)

  • Jul 26 17:32

    kataras on master

    minor, see prev commit (compare)

  • Jul 26 17:28

    kataras on master

    correctly handle recorded compr… (compare)

  • Jul 26 12:48

    kataras on master

    README: minor (compare)

  • Jul 26 11:37

    kataras on master

    Add Configuration.RemoteAddrHea… (compare)

  • Jul 26 10:33

    kataras on master

    HISTORY: move an entry (compare)

  • Jul 26 10:32

    kataras on master

    add HISTORY entry for bfg, an a… (compare)

  • Jul 26 09:30

    kataras on v11.0.2

    (compare)

laowalter
@laowalter
Hi all, I have a closure function, need to initialize with c1 := model.NextPhoto() first, then it will be called like c1(), I would like to run c1() every time by request for post method, but how can I initialize c1 := model.NextPhoto() only once, before post method is ready for request, and then can resoponse by c1() for later request? Thanks for any advice.
Gerasimos (Makis) Maropoulos
@kataras
Any http3 client will work.
Hello @laowalter, you can create a function that returns an iris.Handler, initialize your dependencies in the top function and use them inside the return func(iris.Context)
laowalter
@laowalter
@kataras Many thanks, will try!
Gerasimos (Makis) Maropoulos
@kataras
You are welcome @laowalter, It should look like this:
func handleRoute() iris.Handler {
    c1 := model.NextPhoto()

    return func(ctx iris.Context) {
        c1()
   }
}
app := iris.New()
app.Get("/", handleRoute())
UniónMexicanaDelNorte
@UnionMexicanaDelNorte

Hello!

Any example of chatrooms with golang-iris?

laowalter
@laowalter
@kataras Great! I am looking for this! thanks.
Gerasimos (Makis) Maropoulos
@kataras
Hello @UnionMexicanaDelNorte, yes there is an example of that(neffos, bootstrap, docker) served by net/http at: https://github.com/neffos-contrib/bootstrap-chat , you can easily converted to Iris, take a look at: https://github.com/kataras/iris/tree/v12/_examples/websocket
@laowalter You are welcome, send if you need more
Guillermo Abneed
@Abneed
Good morning!
Excuse me, is there an example in how to integrate neffos.js library with an Angular project, with Observers and Observables?
Gerasimos (Makis) Maropoulos
@kataras
Hello @Abneed, I have almost 4 years to code anything with Angular js. I'll try to implement something for you when I find time, if you have something that I can work in (e.g. a starter kit that you work on) please send it over
basicfu
@basicfu
hello,How to delete the routing?
Vishwas Jagetiya
@vishwas_jagetiy_twitter
Hello
I am facing issues migrating my exisiting websocket code from iris-contrib to kataras/iris/v12/websocket.. please let me know if you can help on that
Guillermo Abneed
@Abneed
Can you share us the error message? @vishwas_jagetiy_twitter
Sujit Prasad Baniya
@itsursujit
Hello,
package main

import (
    "github.com/kataras/iris/v12"
    "iris/app/Http/Controllers"
)

func newApp() *iris.Application {
    app := iris.New()
    app.HandleDir("/assets", "./public/assets")

    return app
}


func main() {
    app := newApp()

    // app.Favicon("./static/favicons/favicon.\\.ico", "/favicon_16_16.ico")
    // This will serve the ./static/favicons/favicon.ico to: localhost:8080/favicon_16_16.ico

    app.Get("/", Controllers.Index)
    app.Get("/landing", Controllers.Landing) // if favicon doesn't show to you, try to clear your browser's cache.
    _ = app.Listen(":8080")
}
This piece of code is not embedding the assets with binary file
Anything wrong I'm doing?
Sujit Prasad Baniya
@itsursujit
How can I integrate pkger?
Enjoy
@mcoo
How to make a 301 redirect which let http => https?
Sujit Prasad Baniya
@itsursujit
Any support on above question?
Gerasimos (Makis) Maropoulos
@kataras

I am facing issues migrating my exisiting websocket code from iris-contrib to kataras/iris/v12/websocket.. please let me know if you can help on that

Hello, yes I've just saw your message, will get back to you soon!

How can I integrate pkger?

Hello, what do you mean? You don't need any special function to integrate it, use it as you use with net/http, instead of w.Write just use ctx.Write.

Excuse me, is there an example in how to integrate neffos.js library with an Angular project, with Observers and Observables?

Hello and sorry for the late response, you are the second person asking for that. The last time I wrote angular was 4 years ago. I don't have the necessary skills to provide you a decent answer. It shouldn't be so hard though. You can read the neffos typescript client code through: kataras/neffos.js. I can add you in the neffos-contrib organisation if you are planning on releasing a library which provides such implementations for neffos. If you don't have the necessary experience, I will find time to do it in my own, (after June) and notify you.

Enjoy
@mcoo
@kataras But when I can not use 80, I want to redirect. For example I get http://xxxxx.com:1234 I want to redirect to https://xxxxxx.com:1234
Enjoy
@mcoo
Ok i know func before(ctx iris.Context) {
if !strings.Contains(ctx.FullRequestURI(),"https") {
ctx.Redirect(strings.ReplaceAll(ctx.FullRequestURI(),"http","https"),302)
return
}
Bharath B
@BharathB23
Hello @kataras,
As of now current active version is v12.1.8, could you please let me know about the upcoming release, tentative timeline, when new version will be available.
IdeaOutline
@IdeaOutline
What hosting companies are available that support Iris?
I will also be using CouchDB and Svelte/Sapper.
Le Minh Duc
@duclm2609
I'm following document of dependency injection, but there is no method: ConfigureContainer from iris v12. I even check the sourcecode. Did the feature removed?
zhiqiude
@zhiqiude
Anybody here?

func main() {

var goCount *int
goCount = flag.Int("goCount", 0, "goroutine number")

//解析输入的参数
flag.Parse()
fmt.Println("go count = ", *goCount)

//get current time
tInsert := time.Now()
fmt.Println("tStart time: ", tInsert)

for i := 0; i < 1000; i++ {

    fmt.Println("goroutine number: ", i)
    //连接servser
    go connectServer()
}

for{
    select {

    }
}
//获取时间差
elapsed := time.Since(tInsert)
fmt.Println("Insert elapsed: ", elapsed)
fmt.Println("/n")

}

Gerasimos (Makis) Maropoulos
@kataras

I'm following document of dependency injection, but there is no method: ConfigureContainer from iris v12. I even check the sourcecode. Did the feature removed?

Hello @duclm2609, sorry for the late response. No the ConfigureContainer is a new feature of the upcoming v12.2.0, which you can grab by go get -u github.com/kataras/iris/v12@master. It is not available on the stable v12.1.8.

Gerasimos (Makis) Maropoulos
@kataras

Anybody here?

Hello @zhiqiude, can I help you with something?

Gerasimos (Makis) Maropoulos
@kataras

What hosting companies are available that support Iris?
I will also be using CouchDB and Svelte/Sapper.

Hello @IdeaOutline, hosting companies can run any type of web application, if you have ssh access or go project support u are fine - you can run it regardless the web framework you are using, e.g. digital ocean, heroku. Now, in the other hand, if you mean customer support specifically for a Go web framework such as Iris, gin and e.t.c. no I don't know any hosting company offers that (at least officially). However, you really don't need thing like that, you have the author of Iris himself who is looking forward to help you and provide assistance whenever you ask.

MahdiEskandari
@mahdipg
hello i start go iris for learning
how i can connect a directory to another directory for example all of my Get code there is in a directory
and all of my Post code there is in other directory
MahdiEskandari
@mahdipg
i have telegram please send my answer
@mahdieskandaripg
Gerasimos (Makis) Maropoulos
@kataras
Hello @mahdipg, yes this is a general GO project structure question
There are many ways, Go works with package, each directory has its own package name and you can import it to other files to use
Let me give you an example
Gerasimos (Makis) Maropoulos
@kataras

Take for example, the directories: /get_code and /post_code. And a main.go file at root which will import and use both of the above.

On the ./get_code/router.go file you do something like that:

package get_code

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

func RegisterGET(r iris.Party) {
  r.Get("/", indexHandler )
  r.Get("/login", loginHandler)
}

func indexHandler(ctx iris.Context) { /* ... */ }
func loginHandler(ctx iris.Context) { /* ... */ }

On the ./post_code/router.go:

package post_code

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

func RegisterPOST(r iris.Party) {
  r.Post("/", indexHandler )
  r.Post("/login", loginHandler)
}

func indexHandler(ctx iris.Context) { /* ... */ }
func loginHandler(ctx iris.Context) { /* ... */ }

Let's assume your go.mod has a module name of "myproject".

module myproject

On the ./main.go file:

package myproject

import (
  "myproject/get_code"
  "myproject/post_code"

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

func main() {
  app := iris.New()

  app.PartyFunc("/",  get_code.RegisterGET)
  app.PartyFunc("/", post_code.RegisterPOST)

  // or:
  // get_code.RegisterGET(app)
  // post_code.RegisterPOST(app)
}
Allan Klaus
@AllanKlaus

Hey guys can someon help me?

I created an api and in one endpoint of this api I receive images in base64, but i'm getting error when with large images. I already so that i need to use the OptionMaxRequestBodySize to change the body limit of an image but I don't know how to use it. I'm new using Go.

Gerasimos (Makis) Maropoulos
@kataras
Exactly @AllanKlaus. Indeed you have many options, depending on the use-case, e.g.:
// to register for a group of routes:
app.Use(iris.LimitRequestBodySize(maxSize))
// to register to a single route:
app.Post("/upload", iris.LimitRequestBodySize(maxSize), myUploadHandler)
// or inside a handler:
ctx.SetMaxRequestBodySize(maxSize)
// or limit global post length
app.Run/Listen(..., iris.WithPostMaxMemory(maxSize))