Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 18 2020 19:48
    PatrickSachs commented #100
  • Nov 18 2020 19:48
    PatrickSachs commented #100
  • Nov 18 2020 19:48
    PatrickSachs commented #100
  • Nov 18 2020 00:18
    YellowApple commented #100
  • Nov 17 2020 20:58
    PatrickSachs closed #100
  • Nov 17 2020 20:58
    PatrickSachs commented #100
  • Nov 13 2020 06:15
    YellowApple commented #100
  • Jul 18 2020 17:21
    PatrickSachs opened #100
  • Mar 11 2020 08:32
    heinrich-fresh edited #99
  • Mar 11 2020 08:31
    heinrich-fresh edited #99
  • Mar 11 2020 08:30
    heinrich-fresh closed #99
  • Mar 11 2020 08:30
    heinrich-fresh opened #99
  • May 31 2019 19:29
    decasm closed #7
  • May 31 2019 17:51
    decasm closed #98
  • May 31 2019 17:51
    decasm closed #8
  • May 31 2019 17:42
  • May 31 2019 17:39
  • May 31 2019 17:37
    decasm opened #98
  • May 31 2019 17:37
    decasm opened #7
  • May 31 2019 17:37
    decasm opened #8
Anne-Gwenn Kettunen
@Annwenn
hai! I just saw that Sugar Framework had been updated to 0.4.7 :)
Ryan S. Northrup (RyNo)
@YellowApple
Oh goody, more things to add to heroku-sucks ;)
It amazes me how Heroku somehow managed to leverage Erlang in such god-awful ways.
Anne-Gwenn Kettunen
@Annwenn
:D
Ryan S. Northrup (RyNo)
@YellowApple
Looks like this week’s Elixir Week on Hacker News :)
Shane Logsdon
@slogsdon
For those that expressed interest in WebSocket support, care to give thoughts? https://github.com/sugar-framework/sugar/issues/51#issuecomment-96428453
Ryan S. Northrup (RyNo)
@YellowApple
Thoughts given, @slogsdon :)
In a nutshell: I think keeping as much macro magic in the router (and out of the controller) as possible would be ideal.
Shane Logsdon
@slogsdon
@YellowApple just read over it. I like your shift of the magical stuff to the router. keeps the controllers a little simpler and is better than my first go :)
Ryan S. Northrup (RyNo)
@YellowApple
Awesome, then I’m not totally insane ;)
Also, these emojis...
These emojis, on the other hand, are very much insane.
Shane Logsdon
@slogsdon
Started in on some WebSocket R&D for Sugar, figuring out what all needs to be done and what will affect our discussion on the router and controller APIs for developers. So far, so good 👍
Ryan S. Northrup (RyNo)
@YellowApple
Cool cool. I've begun work on a separate package (called, fittingly, "Glucose") to test out some implementation ideas in that direction. Most Erlang/Elixir implementations do make the controller do most of the legwork (if they try and fit this into a traditional MVC approach at all; even Phoenix seems to treat WS handlers different from controllers), but I think it's feasible to work around that and keep that initialization in the router (perhaps by leveraging GenServer and automating the creation of and dispatching to child handler processes, which is what I hope to explore with Glucose).
Shane Logsdon
@slogsdon
that sounds like what I'm trying to do. I've always wanted to keep the package separate and targeted really only to plug itself. I want to keep the implementation kind of how http_router works, where one module is used and can be integrated where ever makes sense for a developer (if not using a library that uses the package automatically)
Shane Logsdon
@slogsdon
For anyone interested in the development, you can follow along here: https://github.com/slogsdon/plug-web-socket
Ryan S. Northrup (RyNo)
@YellowApple
Submitted a PR for Sugar.Templates.render/2 to check whether or not it received an error instead of a template key (and, if so, to fail early so that users aren’t totally baffled like I was about stupid things like “oh darn, I put my views in the wrong folder”). @slogsdon, any other considerations before we merge this in?
Anne-Gwenn Kettunen
@Annwenn
Hohai o/
I'm coming back for my 2nd application using Sugar :)
Anne-Gwenn Kettunen
@Annwenn
@slogsdon Hey, I cannot find any documentation on the use of "post" in the router. It must be so obvious it was useless, but still… :s
Shane Logsdon
@slogsdon
it should be just like get but allows for HTTP POST requests. what's giving you problems?
i'd be happy to explain more if needed
Anne-Gwenn Kettunen
@Annwenn
@slogsdon how I actually see what has been poster. I'm working on an URL shortener, and I POST url="foobar.com". Where is it stored? :D
Shane Logsdon
@slogsdon
everything should be in the args argument passed to your controller action
let me double check real quick
yep, that should be it
Anne-Gwenn Kettunen
@Annwenn
oki doki :)
Ryan S. Northrup (RyNo)
@YellowApple
We should probably expand on the relevant documentation; post actions are briefly mentioned in the controller docs, as is the fact that URL params are captured in args, but this isn't really supported in the example code.
Shane Logsdon
@slogsdon
very true
Anne-Gwenn Kettunen
@Annwenn
I agree as well :)
Anne-Gwenn Kettunen
@Annwenn
by the @slogsdon, do you have any clues about #81 ?
Shane Logsdon
@slogsdon
@Annwenn plug was updated at one point to force headers set with Plug.Conn.put_resp_header/3 to have the header name in all lowercase
Anne-Gwenn Kettunen
@Annwenn
hmm okay
Shane Logsdon
@slogsdon
the Sugar.Plugs.HotCodeReload plug just needs to be edited to match
Ryan S. Northrup (RyNo)
@YellowApple
Any input on the docs controller PR before I-
Never mind, @slogsdon just merged it in :P
Damn that was quick.
Anne-Gwenn Kettunen
@Annwenn
damn, that is so clear now…
thank you @YellowApple
Shane Logsdon
@slogsdon
haha. i saw. i clicked. i merged. we can always expand later on it if need be
Anne-Gwenn Kettunen
@Annwenn
\o/
Ryan S. Northrup (RyNo)
@YellowApple
Writing that made me realize that some mechanism for params validation would be useful if one doesn't already exist. I suppose guards could work for simple cases, but I reckon that would get unwieldy in more complex cases.
Anne-Gwenn Kettunen
@Annwenn
that's up the coder's imagination =)
Anne-Gwenn Kettunen
@Annwenn
@YellowApple I found something a bit concerning while reading the docs.
and if I test it with http -j POST "http://localhost:4000/shorten/json" url='http://github.com', I see that there is a params: %{"url" => "http://github.com"} but nothing in the arguments
I must have missed something, but what?
Ryan S. Northrup (RyNo)
@YellowApple
So in total you're getting something like [format: "json", params: %{"url" => "http://github.com"}] in your args?
YellowApple @YellowApple will be the first to admit that he was too lazy to actually pull up one of his projects and verify things...