Live data from Hacker News

Phoenix 1.3 is pure love for API development

swanros.com

11–20 of 57 posts

Re: Phoenix 1.3 is pure love for API development

#11
action_fallback seems like a great addition. It is helpful to expose all your error codes in a single place.

However, I am not too convinced about having a context for each resource. I think that should be optional, meaning that I should be able to specify a context for some related resources but at the same time, I should be able to have resources outside of any context.

Re: Phoenix 1.3 is pure love for API development

#14
post #3

Do you find it's a lot of extra writing for the contexts? I'm new to Phoenix and my first thought is it seemed kind of verbose to define every single 'meeting point' across 'models'. For simple apps it seems OK but I have some complicated apps with many models and interactions

One of the things that is being stressed in this release of Phoenix is that, to paraphrase Chris, your entire application is a model of your domain -- that "models" are really just Ecto schemas, so data, and your web part is really just a shim over your larger application. I encourage you to watch this[0] talk.

[0] https://www.youtube.com/shared?ci=Muyt0zSUAbQ

Re: Phoenix 1.3 is pure love for API development

#15
post #4

I've wanted to use Phoenix a few times but every tutorial to get me started relied 100% on ecto which for something like a transformation API was frustrating. I didn't want the complexity of a database I wanted to learn the request lifecycle in it. Overall, it was challenging with too many resources being out of date or just so focused on a different type of API than I needed to build

Here's [0] a pretty good explanation of how Plug and Conn fit into the mix. Phoenix is just a pipeline of Plugs, which in tern are just modules with init/1 and call/2 functions. Controllers, routes, all of it is just Plugs under the hood. This should help you get your bearings.

[0] http://shankardevy.github.io/code/elixir-phoenix-conn-reques...

Re: Phoenix 1.3 is pure love for API development

#17

I can't wait until May[0] for the new 'Programming Phoenix' book. I found the first edition to be a great learning experience. [0] http://shop.oreilly.com/product/9781680502268.do

Programming Phoenix is one of the few programming books I've read cover to cover. Not only does it cover the nuts and bolts of how to do things it also goes into why things are as they are because it was written by the same team responsible for Phoenix itself.

Re: Phoenix 1.3 is pure love for API development

#18

Best part for me is the new fallback controller plug. Really well done. That and the centralized error list. This is one of the things which is miss in Go (I think this is the same in Rust, but I am not an expert).

Be careful: that is a framework, not a language feature.

Re: Phoenix 1.3 is pure love for API development

#19

action_fallback seems like a great addition. It is helpful to expose all your error codes in a single place. However, I am not too convinced about having a context for each resource. I think that should be optional, meaning that I should be able to specify a context for some related resources but at the same time, I should be able to have resources outside of any context.

It is not a context per resource. The context should group all resources and responsibilities that belong to that context. For example, if you are building Github, you could have an IssuesTracker context where you would find the issues, labels and other all issues tracker related resources in there.

Re: Phoenix 1.3 is pure love for API development

#20
I love elixir and phoenix, I have started learning it around a month ago and it has been a eye opener, the only thing that I struggle are the error messages, sometimes I spend more time than I should try to understand where I made a typo, I am not sure if it's just me because I am so new to this technology or many ppl have the same problem.
Post reply on HN