Hi Scott, As someone that comes from Ruby On Rails, I believe that it is a great thing that you, being a front-end man, explain Phoenix. It gives me an other angle of view that helps me a lot to understand this technology. Great thanks!
What everyone else said and more! Great video, Scott. I particularly like how to threw in tidbits about pipes and aliases, it's real-world examples that help noobs get familiar with the language idiomatically.
Great tutorial, very helpful. I just wanna add that new Phoenix versions use Jason as json parser, so JaSerializer configs should now use "json-api": Jason Also, Scott. I have a question. When creating your Phoenix + Ember projects do you create and host everything in a single Elixir server -- that is, serving the Ember frontend via Phoenix app, or do you do two separate deploys? I do not develop w/ Ember, but I'm interested in knowing this for my Vue/React projects. Thanks again, cheers!
Thanks for watching! To answer your question, I do not host it with Elixir. I typically only use elixir as the API layer. If I did want to, I would reach for Vue instead of Ember as it's less heavy templating fits nicely into a server-side architecture. I know it can be done with React as well, but I don't have experience with that.
for problems with postgress conector change yourself defmodule ProjectManagementExample.Repo do use Ecto.Repo, otp_app: :project_management_example @doc """ Dynamically loads the repository url from the DATABASE_URL environment variable. """ def init(_, opts) do {:ok, Keyword.put(opts, :url, System.get_env("ecto://postgres:postgres@app_dev"))} end end
This is so helpful Scott, do you use Phoenix for api's in your current work flow? Has anything changed in the ja_serializer that you're aware of? I want to create a JSON API for an Ember app :)
Thanks for watching! Yes, I work in the PEEP stack (Postgres, Ember, Elixir, Phoenix :P ). I don't think there have been major changes to ja_serializer since I made this video, although to be fair, I only scratched the surface here.
Ahh, I aim to be a fellow "PEEPER" too, seems like a nice solid stack. If you think you only scratched the surface you should feel free to go into much more detail :D! Haha What would be other "more in depth" things that are not covered here? Are there other resources available? I've looked at the ja_serializer docs, some of it makes sense, some of it doesn't! (I usually rely on videos like these to fully grok things) Anyway cheers
Thx m8 so good and helpful tutorial, i just have 1 problem with postgreSQL , i want admin panel for it like phpmyadmin for mariadb and i find nothing ...
Thanks for watching! I'm not super familiar with GUI's for psql, as I'm pretty comfy writing sql manually. I do know there is a "pgadmin" app: www.pgadmin.org/ But I've never used it personally
hi Mr. Scott i've got a question. For example my Schema user has many to many relationship with tags in default it looks like name , country and tags (tags include name , information like that) if i transform it to json api first i can call attributes [:name, :country] how will i call tags then? i hope you can help me. Thanks
Thanks for watching. Are you running into a particular error? You may need to preload the relationship if you want to include that information. See this: github.com/sbatson5/project_manager_example/blob/6f01efeb7e3d3f1266b2f3c6a65184ffe04786f3/lib/project_manager_example/management/management.ex#L118 Let me know if this helps at all
i already did the preloaded part i just dont know how to call the tags ------------------my old code without using jaserializer--------------------- def render("user.json", %{user: user}) do %{ name: user.name, country: user.country, tags: Enum.map(user.tags, &tag_to_json(&1))} end -------------------- after using jaserializer you can only use attributes [:name, :country] i dont know how will i get the tags
When you say "get the tags" do you mean, just returning them in your JSON payload? If so, you would do that in your view (rather than the render hook). Ja_serializer will know how to handle the relationship: github.com/sbatson5/project_manager_example/blob/6f01efeb7e3d3f1266b2f3c6a65184ffe04786f3/lib/project_manager_example_web/views/document_view.ex#L7-L9
i tried this attributes [:name, :country] has_many :tag, include: true, serializer: UserManagementWeb.TagView the output is {"type":"user", "relationships": {"tag":{"data":null}}, "id":"a87a8506-ef6c-4cdb-861e-9eca7d79dbcd", "attributes":{"name":"Nicholas Shackel","country":"Hong Kong"}}]} the tag is null , btw when using render only it outputs values
@@ScottBatson awww man that's exactly the thing that keeps scaring me from haskell an elixir. I also want to be cool kid writing in big. boy languages :(
@@101graffhead I was definitely hesitant when I first jumped in, but honestly felt like I picked it up faster than I picked OOP. But lol, no such thing as big boy languages. Write what you like 🙌
Thanks Scott, this was a big help. I really like how you had minimal editing so that we could see your thinking and work process.
Hi Scott,
As someone that comes from Ruby On Rails, I believe that it is a great thing that you, being a front-end man, explain Phoenix.
It gives me an other angle of view that helps me a lot to understand this technology.
Great thanks!
Thanks for watching! Glad it was helpful!
What everyone else said and more! Great video, Scott. I particularly like how to threw in tidbits about pipes and aliases, it's real-world examples that help noobs get familiar with the language idiomatically.
Please more elixir tutorials!!! This one was great!
Neat Scott! I never would have discovered your channel if not for this video on Phoenix.
Some slight changes were needed since, obviously, time has changed Pheonix, etc. But great tutorial!
Nice Hands on presentation, Thanks Scott for covering this.
Very nice! , More elixir tutorials please :D
Thanks Scott to show me how to works Elixir with Phoenix!! Great video!! Congrats!!
Wow this is just what I was looking for!
Great video. Helped me to understand about phoenix framework. Thanks.
Thanks for watching!
Great tutorial, very helpful.
I just wanna add that new Phoenix versions use Jason as json parser, so JaSerializer configs should now use
"json-api": Jason
Also, Scott. I have a question. When creating your Phoenix + Ember projects do you create and host everything in a single Elixir server -- that is, serving the Ember frontend via Phoenix app, or do you do two separate deploys?
I do not develop w/ Ember, but I'm interested in knowing this for my Vue/React projects. Thanks again, cheers!
Thanks for watching!
To answer your question, I do not host it with Elixir. I typically only use elixir as the API layer. If I did want to, I would reach for Vue instead of Ember as it's less heavy templating fits nicely into a server-side architecture. I know it can be done with React as well, but I don't have experience with that.
Excellent tutorial. Wish I knew how to use Ember. I'm going to see if I can connect it to Vuejs on the front end.
Thanks for watching! I'm sure there are examples of people using a JSON-API with Vuejs out there
Should learn Ember :)
Great and practical video. I will recommend this to my friends ;)
for problems with postgress conector
change yourself
defmodule ProjectManagementExample.Repo do
use Ecto.Repo, otp_app: :project_management_example
@doc """
Dynamically loads the repository url from the
DATABASE_URL environment variable.
"""
def init(_, opts) do
{:ok, Keyword.put(opts, :url, System.get_env("ecto://postgres:postgres@app_dev"))}
end
end
please, keep going make the next tutorial about elixir phoenix api json
thank you so so so much
nice.
can u make such explanatory video for
whatsApp like server, chatting one to one with mobile number & authentications?
I appreciate this video but its really hard to follow with 360p.
amazing
That was nasty 3:49 😂😂
This is so helpful Scott, do you use Phoenix for api's in your current work flow?
Has anything changed in the ja_serializer that you're aware of?
I want to create a JSON API for an Ember app :)
Thanks for watching! Yes, I work in the PEEP stack (Postgres, Ember, Elixir, Phoenix :P ). I don't think there have been major changes to ja_serializer since I made this video, although to be fair, I only scratched the surface here.
Ahh, I aim to be a fellow "PEEPER" too, seems like a nice solid stack.
If you think you only scratched the surface you should feel free to go into much more detail :D! Haha
What would be other "more in depth" things that are not covered here? Are there other resources available?
I've looked at the ja_serializer docs, some of it makes sense, some of it doesn't! (I usually rely on videos like these to fully grok things)
Anyway cheers
hello sir if i give the command git commit -m 'Initial commit' it shows me ->
pathspec 'commit'' did not match any file(s) known to git
Have you tried this issue: stackoverflow.com/a/16951241/821247. If you are on windows, you must use double quotes when writing commit messages
Thx m8 so good and helpful tutorial, i just have 1 problem with postgreSQL , i want admin panel for it like phpmyadmin for mariadb and i find nothing ...
Thanks for watching! I'm not super familiar with GUI's for psql, as I'm pretty comfy writing sql manually. I do know there is a "pgadmin" app:
www.pgadmin.org/
But I've never used it personally
hi Mr. Scott i've got a question.
For example
my Schema user has many to many relationship with tags
in default it looks like
name , country and tags (tags include name , information like that)
if i transform it to json api first i can call
attributes [:name, :country]
how will i call tags then?
i hope you can help me. Thanks
Thanks for watching.
Are you running into a particular error? You may need to preload the relationship if you want to include that information. See this:
github.com/sbatson5/project_manager_example/blob/6f01efeb7e3d3f1266b2f3c6a65184ffe04786f3/lib/project_manager_example/management/management.ex#L118
Let me know if this helps at all
i already did the preloaded part i just dont know how to call the tags
------------------my old code without using jaserializer---------------------
def render("user.json", %{user: user}) do
%{
name: user.name,
country: user.country,
tags: Enum.map(user.tags, &tag_to_json(&1))}
end
-------------------- after using jaserializer you can only use
attributes [:name, :country]
i dont know how will i get the tags
When you say "get the tags" do you mean, just returning them in your JSON payload? If so, you would do that in your view (rather than the render hook). Ja_serializer will know how to handle the relationship:
github.com/sbatson5/project_manager_example/blob/6f01efeb7e3d3f1266b2f3c6a65184ffe04786f3/lib/project_manager_example_web/views/document_view.ex#L7-L9
i tried this
attributes [:name, :country]
has_many :tag,
include: true,
serializer: UserManagementWeb.TagView
the output is
{"type":"user",
"relationships":
{"tag":{"data":null}},
"id":"a87a8506-ef6c-4cdb-861e-9eca7d79dbcd",
"attributes":{"name":"Nicholas Shackel","country":"Hong Kong"}}]}
the tag is null , btw when using render only it outputs values
Do you happen to have a repo I can see? Happy to take a quick look. Sounds like you are doing things correctly
I know this video is nearly 3 years old but how did you customize iterm2 like that?
Not sure I follow. Can you point me to the timestamp in the video where this happens?
It's a tool called OhMyZsh. That provides those themes and also plug-ins you can use. It's very cool.
awesome bro thx
More elixir please
Model concept does not exist in Phoenix - we are using schemas there :)
Yup! Unfortunately, this video was made 2 years ago and not all of it is applicable anymore
is elixir strictly functional?
Yes, it is
@@ScottBatson awww man that's exactly the thing that keeps scaring me from haskell an elixir.
I also want to be cool kid writing in big. boy languages :(
@@101graffhead I was definitely hesitant when I first jumped in, but honestly felt like I picked it up faster than I picked OOP.
But lol, no such thing as big boy languages. Write what you like 🙌
worst f**ing framework ever