ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
<FromGitter>
<Blacksmoke16> +1 for the rendering feature, i may see why you need content negotiation now ;)
<FromGitter>
<Blacksmoke16> are they global tho? like can you have two diff routes handle returned strings differently?
<FromGitter>
<moe:busyloop.net> heh, yea, that's exactly where i bumped into it. want the default exception handler to render as text when there's no accept json in the request. (because reading escaped json in spec errors is annoying)
<FromGitter>
<moe:busyloop.net> yea they are global atm. the whole thing is a singleton cause no way to make the macro magic work otherwise. but i'll probably add optional scopes at some point to group routes/renderers together. should be doable, just not high on the list atm
<FromGitter>
<Blacksmoke16> if its a singleton, id make sure it properly handles concurrent requests
<FromGitter>
<moe:busyloop.net> yeh it does. i mean it's not fully a singleton. handlers etc. are instances. just `.render` & co are macros, so the top-level has to be pretty much singleton. ⏎ ⏎ but through the voodoo of namedtuples you can of course also have a renderer that does ⏎ https://gist.github.com/m-o-e/8bc1d8aac923002cae8971770e5ea0de - so it's quite flexible overall :) [https:
<FromGitter>
<Blacksmoke16> @nimble:cyberia.club you mean return HTML/JS in the response?
<FromGitter>
<nimble:cyberia.club> Yes
<FromGitter>
<Blacksmoke16> sure, its just a string
<FromGitter>
<nimble:cyberia.club> How do I do it?
<FromGitter>
<Blacksmoke16> just as you would any string
<FromGitter>
<Blacksmoke16> `context.response << "string"`, being one of the ways
<FromGitter>
<moe:busyloop.net> hmm, sounds like you may want a more fully featured framework like athena, amber or lucky. returning raw html like that works but will get cumbersome for anything but very simple cases
<FromGitter>
<Blacksmoke16> or at least use a templating engine like Crinja or ECR
<FromGitter>
<moe:busyloop.net> yup
<FromGitter>
<nimble:cyberia.club> Its my first tome using crystal I am just getting the basics sorry
<FromGitter>
<nimble:cyberia.club> and documentation is hard to find
<FromGitter>
<nimble:cyberia.club> Alright that worked now thanks!
<FromGitter>
<nimble:cyberia.club> I have another question however and I don't think I have seen this one being asked
<FromGitter>
<nimble:cyberia.club> How can I make the server "reactive" I mean updating it without reloading. I have seen it is capable of such in the playground
<FromGitter>
<Blacksmoke16> `crystal play` you mean?
<FromGitter>
<Blacksmoke16> it uses websockets
<FromGitter>
<nimble:cyberia.club> Thing is I want to do a countdown timer I already got most of the Time logic already
<FromGitter>
<nimble:cyberia.club> Yes
<FromGitter>
<nimble:cyberia.club> But it only updates for whoever is seeing the page if they refresh it
<FromGitter>
<nimble:cyberia.club> I really want to avoid using javascript for this
<FromGitter>
<nimble:cyberia.club> Since I want to learn crystal
<FromGitter>
<nimble:cyberia.club> I will give it a look
<FromGitter>
<Blacksmoke16> im pretty sure you have to use *some* JS
<FromGitter>
<Blacksmoke16> as the server cant return interactive context afaik?
<FromGitter>
<Blacksmoke16> since the HTML would be static
<FromGitter>
<Blacksmoke16> tho ofc its Rails, dont think anything like that exists in Crystal land atm
She has joined #crystal-lang
jmdaemon has quit [Ping timeout: 268 seconds]
jmdaemon has joined #crystal-lang
ur5us_ has quit [Ping timeout: 272 seconds]
<FromGitter>
<rishavs> If there is a need to refresh it, this sounds like a simple server side logic. If you want to do this without refreshing the page you will need either JS (the normal way) or websockets (the way Elixir liveView uses)
nq_ has quit [Ping timeout: 252 seconds]
jhass[m] has quit [Quit: Bridge terminating on SIGTERM]
Melancholia[m] has quit [Quit: Bridge terminating on SIGTERM]
jhass[m] has joined #crystal-lang
Melancholia[m] has joined #crystal-lang
jmdaemon has quit [Ping timeout: 252 seconds]
<FromGitter>
<SebastianSzturo> Is there an official crystal shards website? Seems like most of the ones linked have expired ssl certificates and are unmaintained
<jhass[m]>
shards is designed as a decentralized system, so not really. https://shardbox.org/ is as close as it gets being maintained by one of the core team
<jhass[m]>
what all the broken sites mostly did was just returning the results for a github search with language:crystal anyhow
<FromGitter>
<SebastianSzturo> Ah makes sense, thanks you!
<FromGitter>
<moe:busyloop.net> i still hope crystalshards.org will be recovered. it's been the most useful of the bunch :(