<FromGitter>
<j8r> the whole book, not only the overview
<FromGitter>
<oren> @j8r damn!
<FromGitter>
<tenebrousedge> when I was first picking up Crystal I figured I didn't need to read the book, because I knew Ruby, and I figured I could pick things up as I went along. Plus, the book seemed like it was written more for people who were new to programming
<FromGitter>
<Daniel-Worrall> That's only an introduction to the language too
<FromGitter>
<tenebrousedge> I should have read the book
<FromGitter>
<j8r> not only an intro @Daniel-Worrall
<FromGitter>
<j8r> there are also advanced topics, like macros, struct vs class, bindings
<FromGitter>
<oren> it looks like crystal's type of documentation is Reference. What's missing is Tutorials and How-to Guides - https://www.divio.com/blog/documentation
<FromGitter>
<oren> what i really like is a complete app with comments next to most of the lines that requires explanation
<FromGitter>
<oren> that way you learn by building a real app and you can play with the concepts in the context of a real code and not a separate doc
<FromGitter>
<Blacksmoke16> im sure that would be something good to do
<FromGitter>
<Blacksmoke16> just hasnt been done yet
<FromGitter>
<dscottboggs_gitlab> I've actually been working on a crystal-by-example project based on go-by-example
<FromGitter>
<dscottboggs_gitlab> It's not as good as some other beginner resources but every little bit helps
<FromGitter>
<dscottboggs_gitlab> (a by-example site, I mean)
<FromGitter>
<tenebrousedge> @dscottboggs_gitlab need any help with that?
<FromGitter>
<dscottboggs_gitlab> I will once I get deployment down. I've had a really solid webservice deployment strategy for the past couple years and I went and fucked it all up a few weeks ago. Working on that now.
<FromGitter>
<dscottboggs_gitlab> I wanna get it up with a few examples first, then I'll ask for help on the actual examples themselves
<FromGitter>
<dscottboggs_gitlab> thank you
<FromGitter>
<tenebrousedge> I like circleci + docker o.o
<FromGitter>
<dscottboggs_gitlab> how does that work on a single-server instance?
<FromGitter>
<tenebrousedge> CCI builds and pushes the image, server runs it
<FromGitter>
<dscottboggs_gitlab> what about handling of redirects to multiple services and SSL integration?
<FromGitter>
<tenebrousedge> that sounds like a job for traefik
<FromGitter>
<dscottboggs_gitlab> yeah that's what I've been using and switching to traefik 2.0 was the "fucking it all up" that I did a few weeks ago π
<FromGitter>
<tenebrousedge> ah π
<FromGitter>
<Blacksmoke16> nginx?
<FromGitter>
<tenebrousedge> nginx is good
<FromGitter>
<dscottboggs_gitlab> which made me realize that I need to have separate subvolumes for mount points and configs, so I've gotta rebuild my shit one way or the other anyway
<FromGitter>
<Blacksmoke16> reverse proxy to non directly exposed api service
<FromGitter>
<Blacksmoke16> then nginx handles ssl and everything
<FromGitter>
<tenebrousedge> @Blacksmoke16 have you checked out traefik? particularly in combination with docker?
<FromGitter>
<dscottboggs_gitlab> See, that was my first thought -- a crystal service which checks docker labels and builds a `sites-enabled/<subdomain>` file automatically. I talked about that with @j8r in his dfabric room though and he recommended caddy which looks really nice. So I'm gonna try that as soon as I get my subvolumes set up.
<FromGitter>
<eliasjpr> I want to do something like Response(T) < HTTP::Server::Respnse
<FromGitter>
<eliasjpr> so I can inject the type I want the response to produce
<FromGitter>
<eliasjpr> the request processor creates an instance of the response for you
<FromGitter>
<Blacksmoke16> how are you planning on applying your custom response?
<FromGitter>
<Blacksmoke16> override the method it gets newed up in?
<FromGitter>
<eliasjpr> I find that a little not to good cause how does the request know what I want to respond with
<FromGitter>
<eliasjpr> I was going to replace the response with a specialized one
<FromGitter>
<Blacksmoke16> i personally find it a bit strange that the response obj is included with the request, versus having the user new one up to return
<FromGitter>
<Blacksmoke16> could just add a method to the context? like `context.response = my_custom_response_type`?
<FromGitter>
<eliasjpr> basically in a handler I can simple do context.response = MyCoolResponse.new(context.response)
<FromGitter>
<Blacksmoke16> ah yea
<FromGitter>
<eliasjpr> something like that
<FromGitter>
<Blacksmoke16> what about keeping your response type separate and at the end just copying the results to the actual one
<FromGitter>
<eliasjpr> let me see if context allows you to overwrite it
<FromGitter>
<Blacksmoke16> that would avoid having to do these overrides
<FromGitter>
<eliasjpr> yeah the context is read only
<FromGitter>
<eliasjpr> thats a lot of overhead no?
<FromGitter>
<eliasjpr> I think I am just going to override the response class
<FromGitter>
<eliasjpr> I dont want to open it :(
<FromGitter>
<Blacksmoke16> whats the end goal here?
<FromGitter>
<Blacksmoke16> for amber i assume?
<FromGitter>
<eliasjpr> have a type generic for Response
<FromGitter>
<eliasjpr> Response(T)
<FromGitter>
<Blacksmoke16> in order to do what? in the end everything is going to be a String no?
<FromGitter>
<eliasjpr> Maybe for amber if the thought is forward thinking
<FromGitter>
<eliasjpr> well the response will be type safe
<FromGitter>
<eliasjpr> so it wont produce any string
<FromGitter>
<eliasjpr> will product a specific string/io
<FromGitter>
<eliasjpr> same for request
<FromGitter>
<Blacksmoke16> got an example?
<FromGitter>
<eliasjpr> if I have a Request(T) we can parse the params into an object
<FromGitter>
<Blacksmoke16> wouldnt that tightly couple the param parsing with the request?
<FromGitter>
<eliasjpr> for instance in java there is a RequestEntity(T) and ResponseEntity(T)
<FromGitter>
<eliasjpr> you will still have access to params in the controller
<FromGitter>
<eliasjpr> but also an object/struct with the right values
<FromGitter>
<eliasjpr> we can generate this object at the controller too
<FromGitter>
<eliasjpr> but thats more macros and reflexion to do that
<FromGitter>
<Blacksmoke16> it sounds like you want to do something similar like i did for Athena
<FromGitter>
<Blacksmoke16> but with a diff approach
<FromGitter>
<eliasjpr> I want to be able to define a route like get "/address", AddressRequest, AddressResponse
<FromGitter>
<eliasjpr> as a vague example
<FromGitter>
<Blacksmoke16> if that maps to a method, wouldnt restricting the return type of that method "handler" be enough?
<FromGitter>
<eliasjpr> right now all the frameworks for crystal has some magic to parse parameters and serializers (I have look at athena) and I want to avoid that
<FromGitter>
<eliasjpr> since most APIs you know ahead of time the input and output
<FromGitter>
<Blacksmoke16> not really any magic imo
<FromGitter>
<eliasjpr> mmm I have to look into athena
<FromGitter>
<eliasjpr> that looks interesting
<FromGitter>
<Blacksmoke16> that handles the request side of things, next feature i want to add is for the response side of things
<FromGitter>
<eliasjpr> you are using annotations
<FromGitter>
<Blacksmoke16> the idea is your action "handler" returns a specific type, then there is a view layer that controls resolving that response into a String to actually return
<FromGitter>
<Blacksmoke16> i.e. if your action returns a `User` obj, then the view layer could be like doing `response.to_json ctx.response`
<FromGitter>
<eliasjpr> yes, thought in the right direction
<FromGitter>
<Blacksmoke16> or if your action returns `ART::Response` then skip the view layer and just copy the data to the actual response
<FromGitter>
<Blacksmoke16> which would allow you to also have like `RedirectResponse.new "https://google.com"`
<FromGitter>
<Blacksmoke16> but thanks, annotations ftw :p
<FromGitter>
<eliasjpr> I dont see the ART::Response class, but you have the right thought
<FromGitter>
<Blacksmoke16> future feature* sorry
<FromGitter>
<eliasjpr> :)
<FromGitter>
<Blacksmoke16> atm it just json encodes everything
<FromGitter>
<eliasjpr> got it
<FromGitter>
<eliasjpr> so as you work on this feature keep in mind that you know ahead of time what your response should be, including the mime type
<FromGitter>
<Blacksmoke16> wanted to get the core stuff solid before moving on, and JSON is the most common so meh
<FromGitter>
<Blacksmoke16> is where you could have `JSONResponse.new obj.to_json` which would handle setting the required headers and such
<FromGitter>
<eliasjpr> for the moment I am going to add a couple of property to the standard lib Response
<FromGitter>
<Blacksmoke16> main challenge will be knowing *which* view layer to call, as ill have to determine it from the request
<FromGitter>
<Blacksmoke16> sounds like a plan
<FromGitter>
<Blacksmoke16> get something working then can always iterate on it
<FromGitter>
<eliasjpr> true
<FromGitter>
<Blacksmoke16> was thinking initial version would have you specify which ones, where in future can just handle it for you based on like `Accept`
<FromGitter>
<eliasjpr> I am still curious how the Object.clone could be use in crystal and if that was a good approach
<FromGitter>
<Blacksmoke16> i think it would fail if you had some type that didnt have a clone method
<FromGitter>
<eliasjpr> You mean `Content-Type` header
<FromGitter>
<dscottboggs_gitlab> wait how does the compiler know the difference between `b * rest` and `b *rest`??
<FromGitter>
<dscottboggs_gitlab> checking whitespace seems a little iffy
<FromGitter>
<tenebrousedge> I think you're confusing `b * rest` with `b, *rest`
<FromGitter>
<dscottboggs_gitlab> I mean `b(*rest)` without the parens
<FromGitter>
<tenebrousedge> tuples are complicated
<FromGitter>
<Daniel-Worrall> When it's ambiguous, you must specify
<FromGitter>
<grkek> I got to the splats again and got it working, thank you.
<FromGitter>
<grkek> Implemented some better readability
<FromGitter>
<dscottboggs_gitlab> π
<FromGitter>
<grkek> with it as well
<FromGitter>
<dscottboggs_gitlab> cool!
<FromGitter>
<grkek> Is it okay to simultaneously release 4 versions :D
<FromGitter>
<grkek> ?
<FromGitter>
<grkek> Ive got ideas rushing in
<FromGitter>
<btihen> Is there a way to tell HTTP::Client to be relaxed with a self-signed cert? I wrote a mini test https server and a mini - http test client - but I can't figure out how to get the client to be ok with my self-signed cert - just for testing. β β ```response = HTTP::Client.get "https://localhost:8443"``` [https://gitter.im/crystal-lang/crystal?at=5e2da5a9a9b30639e2eda568]
<FromGitter>
<btihen> My mini-server works - if I answer all the warnings that its a dangerous self-signed site & the client works with a legitimate https site like github
<FromGitter>
<grkek> There was an option
<FromGitter>
<grkek> somewhere
<FromGitter>
<grkek> I dont remember tbh
<FromGitter>
<btihen> I've looked through the http::client docs ans ssl docs (has an insecure option), but I'm not clear from the docs on how to configure the ssl client within the http client there doesn't seem to be a bind_ssl in the client like with the server so i'm not sure how to invoke insecure on the client
<FromGitter>
<btihen> Any idea on if I should check a differnt api
<FromGitter>
<btihen> I also checked the URI api - I don't see any hints there either
<FromGitter>
<grkek> Try looking into the source code
<FromGitter>
<grkek> It is probably a binding to the lib ssl
<FromGitter>
<grkek> which might be interesting
<FromGitter>
<grkek> if youre new to bindings
<FromGitter>
<tenebrousedge> you can pass an instance of openssl::SSL::Context::Client to HttpClient
<FromGitter>
<grkek> The macro overrides the router
<FromGitter>
<grkek> without the macro it waits for the router to respond
<FromGitter>
<btihen> @grkek I have been reviewing the source code. I am doing these things indeed to learn more. So I will explore the binding.
<FromGitter>
<btihen> @tenebrousedge - thanks - I'll check out those links and see what I can come up with
<FromGitter>
<grkek> @btihen Good luck with coding mate
<FromGitter>
<tenebrousedge> so cooking is a thing that I do fairly often. I've been trying to get better at plating things. Last night I made sous vide scallops, with a spicy thai apple mango salad. How does it look (https://ibb.co/GnGz90g)?
<FromGitter>
<grkek> It looks so cute <3
<FromGitter>
<grkek> and yummy
<FromGitter>
<grkek> HMMM
<FromGitter>
<tenebrousedge> the scallops weren't done to any particular recipe: smoked paprika and black pepper, cooked at 124 F for 30 minutes, finished with a blowtorch. The salad recipe is here (https://pickledplum.com/thai-apple-salad-recipe/); I've been making it over and over again since I found it
<FromGitter>
<grkek> Looks pretty healthy
<FromGitter>
<grkek> Id eat one
<FromGitter>
<tenebrousedge> caution: do not be tempted to add more chiles. Two is plenty
<FromGitter>
<grkek> I am a spicy lover
<FromGitter>
<grkek> I sure know I wil lad a lot
<FromGitter>
<btihen> @grkek - thanks - the SSL::Client link helped - i just didn't open enough of the sub-menus for the ssl library -- so I found the `verify-mode=none` - cool! Now I'm playing with getting the http client to see the ssl client config
<FromGitter>
<grkek> Lovely !
<FromGitter>
<grkek> I am trying to keep my framework together and failing at the same time :D
<FromGitter>
<grkek> @Blacksmoke16 Can you check out the readme example and tell me what you think ?