by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 30 2019 08:08
    hoang17 starred kemalcr/kemal
  • Jan 30 2019 06:38
    cayter starred kemalcr/kemal
  • Jan 27 2019 18:40
  • Jan 27 2019 15:56
    sdogruyol closed #498
  • Jan 27 2019 15:56
    sdogruyol commented #498
  • Jan 27 2019 15:53
    sdogruyol closed #509
  • Jan 27 2019 15:53
    sdogruyol commented #509
  • Jan 27 2019 05:14
    mjb2kmn starred kemalcr/kemal
  • Jan 25 2019 01:42
    unixc3t starred kemalcr/kemal
  • Jan 24 2019 22:41
    talentlessguy starred kemalcr/kemal
  • Jan 24 2019 04:00
    ntilotta starred kemalcr/kemal
  • Jan 23 2019 10:12
    iwaruby starred kemalcr/kemal
  • Jan 23 2019 02:35
    isaced starred kemalcr/kemal
  • Jan 21 2019 18:33
    f9n starred kemalcr/kemal
  • Jan 19 2019 12:53
    SeedyROM starred kemalcr/kemal
  • Jan 17 2019 19:06

    sdogruyol on master

    Do not try to call ExceptionHan… Merge pull request #515 from ke… (compare)

  • Jan 17 2019 19:06
    sdogruyol closed #515
  • Jan 17 2019 19:06
    sdogruyol closed #514
  • Jan 17 2019 19:06
    sdogruyol edited #515
  • Jan 17 2019 15:09
    galfarragem starred kemalcr/kemal
Matias Russitto
@russitto_gitlab
yes
interpolated: 401513 requests in 10.01s
<<: 232578 requests in 10.01s
kemal app.cr with custom logger snippet: https://gitlab.com/snippets/1969449
Matias Russitto
@russitto_gitlab
stress params: wrk -t 8 -c 32 -d 10s http://localhost:3000/
Ed
@drum445
This is the structure I use for projects
image.png
The controllers dir is just there to split the routes up
image.png
Same way I deal with large Sinatra apps
Never had a problem with it
Giorgi Kavrelishvili
@grkek
@russitto_gitlab that's crazy
I thought << had advantages over interpolated
boy I was wrong
xmonader
@xmonader

Hi I've a server based on kemal

module TfWiki
  class WikiServer
    def send_from_dirsinfo(env, filename)
      if @walker.dirsfilesinfo.has_key?(filename)
        firstpath = @walker.dirsfilesinfo[filename].paths[0] # in decent repo it will be only 1 in this array.
        send_file env, firstpath

        env.response.status_code = 404
        env.response.print "file #{filename} doesn't exist in scanned info."
        env.response.close
      end
    end

    get "/wiki/:filename" do |env|
      puts "Got request.."
      puts env.request.resource
      filename = env.params.url["filename"]
      unless filename.ends_with?(".md")
        filename = filename + ".md"
      end
      send_from_dirsinfo(env, filename)
    end

but i keep getting

Error: undefined method 'send_from_dirsinfo' for TfWiki::WikiServer.class
John Hayes-Reed
@John-Hayes-Reed
Hi all, sorry for the potentially silly question, been trying to form a spec using spec-kemal for a post request, and I can't seem to form a correct "body" that inputs parameters for the POST request, resulting in not being able to form a correct request for a POST using the "post" method provided by spec-kemal, any examples or direction on how to correctly form that would be of great help.
Giorgi Kavrelishvili
@grkek
Can you show an example of your code?
Massimiliano Bertinetti
@Acciaiodigitale
@xmonader It's not clear because your code is partial. can you point me to the complete source
@drum445 Yeah mine is similar
@grkek @russitto_gitlab here B. Cardiff explain the internal about << and interpolation: https://www.youtube.com/watch?v=LTFLY9tMvIc
Matias Russitto
@russitto_gitlab
thx
John Hayes-Reed
@John-Hayes-Reed
@grkek
headers = HTTP::Headers.new
headers.add "Content-Type", "application/json"
params = { email: "TEST@TEST.COM", password: "TEST_PASSWORD" }.to_json
post "/registrations", headers, params
Giorgi Kavrelishvili
@grkek
And the error is what?
John Hayes-Reed
@John-Hayes-Reed
When the request comes through to the action the params are nowhere to be seen
Giorgi Kavrelishvili
@grkek
That's interesting
John Hayes-Reed
@John-Hayes-Reed
Anyone have any ideas on why the above may be happening? Is it an issue in spec-kemal? or is it a "problem exists between chair and keyboard PEBCAK error" with me?
Sam Rowe
@srowe_gitlab
Hi everyone. Is this still the best practice for streaming responses? kemalcr/kemal#151
YukiSakuraVN
@YukiSakuraVN
Hi. Anyone have any ideas if before_all still run before web socket.
Sam Rowe
@srowe_gitlab
seems easy to test
Giorgi Kavrelishvili
@grkek
@YukiSakuraVN WebSockets are defined in the WebSocket router which I think is not supported by the filter middleware
      # This can be called directly but it's simpler to just use the macros,
      # it will check if another filter is not already defined for this
      # verb/path/type and proceed to call `add_route_filter`
      def before(verb : String, path : String = "*", &block : HTTP::Server::Context -> _)
        _add_route_filter verb, path, :before, &block
      end
the filter singleton has this functiom which can be used to define a before call to the path of the router
and the verb used by the router is GET
basically yeah you can use the default
before_all macro
xmonader
@xmonader
can someone merge this please? kemalcr/kemal-session#87
Julien Reichardt
@j8r
I wander why it is kemal-specific...
xmonader
@xmonader
is there an option to change the router in kemal from radix tree?
Nicolas Talle
@Nicolab
Giorgi Kavrelishvili
@grkek
it goes very fast
Nicolas Talle
@Nicolab
Is it to execute HTTP requests via Unix domain socket? (Like the Docker daemon)
Julien Reichardt
@j8r
UNIX socket is a feature on UNIX-like OSes.
A CLI communicating to a deamon through a socket is a use case, yes.
Nelcifran
@NelcifranMagalhaes
HI guys, I'm a newer in Crystal and kemal, today i decided to create my first app with kemal, I'm a Rails developer.
In ruby we have certain code pattern, where i found this in Kemal/Crystal?
like Rubocop, or where i put my connection with database...like this
Muhammed Yaşar
@yorci
Hi @NelcifranMagalhaes, Kemal is sinatra like micro framework. It doesnt provide you boilerplate, so you can make your own structure as you wish.
Nelcifran
@NelcifranMagalhaes
ok @yorci , thanks
Nicolas Talle
@Nicolab
Thanks @j8r
Muhammed Yaşar
@yorci
i have an issue with the send_file method, we are running kemal on backend of heavy loaded file server which is let people download videos. Its alright, kemal doing nice but after a video downloaded (which is done without any error or video corruption) kemal or crystal throws "Error writing to socket: Connection reset by peer". I couldnt find any proper solution, any solution ideas? if any of you guys doesnt have idea i will just ignore that error :smirk:
@sdogruyol I think you have encountered this error before, any suggestion?