ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
olbat__ has quit [Quit: Bye ...]
olbat has joined #crystal-lang
olbat has quit [Changing host]
olbat has joined #crystal-lang
jmdaemon has quit [Ping timeout: 250 seconds]
<frojnd> Hi there.
<frojnd> I would like to build a simple file server with Kemal. I am looking at apps that are built with Kemal so I can see what's the file structure of source code. Any good examples?
<FromGitter> <> frojnd: maybe
<frojnd> @moe thank you will take a look right away
<FromGitter> <> i'm testing the "threads" feature on Matrix (test post, please ignore)
<FromGitter> <oprypin> and testing from here as well
<FromGitter> <> hm, seems that Gitter and Matrix now behave the same regarding threads :) ⏎ though that is still not represented in any way by the bridge to IRC
<frojnd> Hm hm
<frojnd> But when I try to upload some file I get: Exception: Cannot extract form-data from HTTP request: could not find boundary in Content-Type (HTTP::FormData::Error)
<FromGitter> <> sounds like you'e posting with the wrong content-type
<frojnd> What is the correct content-type ?
<FromGitter> <> `multipart/form-data.`
<FromGitter> <> e.g.
<frojnd> It's a progress but now I see: Exception: Missing hash key: "image1" (KeyError)
<frojnd> curl -v -F image1=value1 upload=@bla.txt
<frojnd> Not sure what that error means
<FromGitter> <> sorry, not sure either (i'm not very familiar with kemal)
<frojnd> Ha, was looking at wrong code
<frojnd> File Upload
<frojnd> Any ideas how to access public folder?
<frojnd> Like I have uploads there with some files... I would like to access those files within crystal
jmdaemon has joined #crystal-lang
<FromGitter> <Blacksmoke16>
<FromGitter> <> @Blacksmoke16: it's... alive! 😎
<FromGitter> <Blacksmoke16> nice! congrats!
<frojnd> @Blacksmoke16 yeah, but when I write get "/uploads" do ... end how do I list everything inside public/uploads ?
<FromGitter> <Blacksmoke16> would have to write something to do that
<FromGitter> <Blacksmoke16> provides a way to render an index listing (like you'd get going to that directory in chrome), but not sure if kemal has something similar/equivalent
<FromGitter> <Blacksmoke16> looks like theres a config for `dir_listing` you have to enable?
<FromGitter> <Blacksmoke16> er a few sections down
<frojnd> @Blacksmoke16 just adding serve_static({"gzip" => true, "dir_listing" => true}) inside get "uploads" do ... end did the trick
<frojnd> However if I wanted to add more content to a listed file there like upload date etc would I have to write my own StaticFileHandler ?
avane has quit [Ping timeout: 248 seconds]
avane has joined #crystal-lang
<FromGitter> <Blacksmoke16> e.g. your own template provided to `ECR.def_to_s `
<FromGitter> <Blacksmoke16> but probably going to need to do something more given youd only have access to the file name and path in the stdlib context
<FromGitter> <Blacksmoke16> eh well maybe you could path in a `#info` method into it as well :shrug:
<FromGitter> <skinnyjames> Hi all, just want to verify - is there a way to set the receiver of a captured block?
<yxhuvud> don't think so.
<yxhuvud> I think the only way to modify the receiver only works on non-captured blocks
<FromGitter> <skinnyjames> ah thanks!
<FromGitter> <Blacksmoke16> Could you wrap it in another proc? 😛
<FromGitter> <skinnyjames> probably!
<FromGitter> <skinnyjames> it might be better to define methods via a macro than nest procs i think
<FromGitter> <Blacksmoke16> probably
<FromGitter> <skinnyjames> I'm trying to port (perhaps a saner version) of a test runner/library I wrote in ruby that privileges the ops side of devops. ⏎ It should support writing custom harnesses, which would make parallelism fairly trivial. ⏎ It's a pet project for sure, but I'd be curious if it would provide value
<FromGitter> <Blacksmoke16> some people like the extra features of minitest or spectator, so might be helpful to those people. Otherwise will be hard to top the stdlib for ease of use
<FromGitter> <skinnyjames> I really like stdlib for sure
<FromGitter> <skinnyjames> spectator has a lot of nice features, but I'm more interested in the runtime part