Build a JSON API with Elixir / Phoenix in under an hour

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 51

  • @Viewport98
    @Viewport98 7 років тому +10

    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.

  • @Canardeur
    @Canardeur 6 років тому +1

    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!

    • @ScottBatson
      @ScottBatson  6 років тому

      Thanks for watching! Glad it was helpful!

  • @MichaelWarnerCreates
    @MichaelWarnerCreates 7 років тому +3

    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.

  • @tomazbracic6568
    @tomazbracic6568 6 років тому +5

    Please more elixir tutorials!!! This one was great!

  • @AlchemistCamp
    @AlchemistCamp 6 років тому +3

    Neat Scott! I never would have discovered your channel if not for this video on Phoenix.

  • @TheJ2quinn
    @TheJ2quinn 3 роки тому +2

    Some slight changes were needed since, obviously, time has changed Pheonix, etc. But great tutorial!

  • @udhayvtube
    @udhayvtube 6 років тому +1

    Nice Hands on presentation, Thanks Scott for covering this.

  • @mohamednasser7472
    @mohamednasser7472 6 років тому +11

    Very nice! , More elixir tutorials please :D

  • @eltonsimoresm
    @eltonsimoresm 6 років тому

    Thanks Scott to show me how to works Elixir with Phoenix!! Great video!! Congrats!!

  • @smoothbeak
    @smoothbeak 7 років тому +3

    Wow this is just what I was looking for!

  • @renatoramiro
    @renatoramiro 7 років тому +1

    Great video. Helped me to understand about phoenix framework. Thanks.

  • @escribapetrus
    @escribapetrus 4 роки тому +4

    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!

    • @ScottBatson
      @ScottBatson  4 роки тому

      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.

  • @calstate
    @calstate 6 років тому +1

    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.

    • @ScottBatson
      @ScottBatson  6 років тому

      Thanks for watching! I'm sure there are examples of people using a JSON-API with Vuejs out there

    • @smoothbeak
      @smoothbeak 6 років тому

      Should learn Ember :)

  • @MarioMeyrelles
    @MarioMeyrelles 6 років тому

    Great and practical video. I will recommend this to my friends ;)

  • @vagnerasilva
    @vagnerasilva 6 років тому

    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

  • @apd3345
    @apd3345 6 років тому

    please, keep going make the next tutorial about elixir phoenix api json
    thank you so so so much

  • @masoomsanadi
    @masoomsanadi 3 місяці тому

    nice.
    can u make such explanatory video for
    whatsApp like server, chatting one to one with mobile number & authentications?

  • @tamasvarga9862
    @tamasvarga9862 6 років тому

    I appreciate this video but its really hard to follow with 360p.

  • @varshneydevansh
    @varshneydevansh Рік тому

    amazing

  • @namachi
    @namachi 4 роки тому

    That was nasty 3:49 😂😂

  • @smoothbeak
    @smoothbeak 6 років тому +1

    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 :)

    • @ScottBatson
      @ScottBatson  6 років тому +1

      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.

    • @smoothbeak
      @smoothbeak 6 років тому

      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

  • @padmapriya8814
    @padmapriya8814 3 роки тому

    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

    • @ScottBatson
      @ScottBatson  3 роки тому

      Have you tried this issue: stackoverflow.com/a/16951241/821247. If you are on windows, you must use double quotes when writing commit messages

  • @mohammadrezaroustana1055
    @mohammadrezaroustana1055 5 років тому

    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 ...

    • @ScottBatson
      @ScottBatson  5 років тому

      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

  • @berlyntumaneng9285
    @berlyntumaneng9285 6 років тому +1

    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

    • @ScottBatson
      @ScottBatson  6 років тому

      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

    • @berlyntumaneng9285
      @berlyntumaneng9285 6 років тому

      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

    • @ScottBatson
      @ScottBatson  6 років тому

      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

    • @berlyntumaneng9285
      @berlyntumaneng9285 6 років тому

      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
      @ScottBatson  6 років тому

      Do you happen to have a repo I can see? Happy to take a quick look. Sounds like you are doing things correctly

  • @dashl5069
    @dashl5069 5 років тому

    I know this video is nearly 3 years old but how did you customize iterm2 like that?

    • @ScottBatson
      @ScottBatson  5 років тому

      Not sure I follow. Can you point me to the timestamp in the video where this happens?

    • @pointerish
      @pointerish 3 роки тому

      It's a tool called OhMyZsh. That provides those themes and also plug-ins you can use. It's very cool.

  • @hectormarin5582
    @hectormarin5582 6 років тому

    awesome bro thx

  • @aminelouni
    @aminelouni 3 роки тому

    More elixir please

  • @KociKociamber
    @KociKociamber 5 років тому +1

    Model concept does not exist in Phoenix - we are using schemas there :)

    • @ScottBatson
      @ScottBatson  5 років тому +1

      Yup! Unfortunately, this video was made 2 years ago and not all of it is applicable anymore

  • @101graffhead
    @101graffhead 4 роки тому

    is elixir strictly functional?

    • @ScottBatson
      @ScottBatson  4 роки тому

      Yes, it is

    • @101graffhead
      @101graffhead 4 роки тому

      @@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 :(

    • @ScottBatson
      @ScottBatson  4 роки тому

      @@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 🙌

  • @jimmyfitzsimmons7170
    @jimmyfitzsimmons7170 4 роки тому

    worst f**ing framework ever