3. Using Phoenix Framework to Generate JSON Resources for Elixir REST API Project

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

КОМЕНТАРІ • 57

  • @DanielBergholz
    @DanielBergholz Місяць тому +3

    10:33 Useful note: when using the generators from Phoenix (mix phx.gen.json), you can type "email:string:unique", and it will automatically create the index inside the migration file

    • @elixirmentor
      @elixirmentor  Місяць тому +1

      Oh, that is amazing! I didn’t know that.

    • @DanielBergholz
      @DanielBergholz Місяць тому

      @@elixirmentor There are also redact columns, for example, "password:string:redact" and even enums "status:enum:unpublished:published:deleted"

    • @elixirmentor
      @elixirmentor  Місяць тому +1

      @DanielBergholz 🤯 life changing

  • @jaymartinez311
    @jaymartinez311 Рік тому +5

    Just real quick, I get why you made this playlist just the backend stuff so far. That transition from phoenix/liveview going to 1.7 seems like a major change. It’s like everybody is waiting for it to drop like 50 Cent back in the day 😂. I kinda caught elixir and phoenix in the crossroads of where they are headed. My point is thanks for the videos. It seems a lot of these nested folders are getting combined for less confusion in 1.7. I also saw a video on Liveview surface, which makes phoenix Liveview work more like react, with a prop system and just required props. Components taking children etc. Thanks for the videos though. Every chance I get I get in 20 minutes here and there. (Still in College at 39yrs old) So it’s greatly appreciated.

    • @elixirmentor
      @elixirmentor  Рік тому +5

      I mean my channel is called backend stuff....😉. So I wouldn't expect much liveview coming from me haha. But 1.7 should be pretty awesome for sure!

    • @jaymartinez311
      @jaymartinez311 Рік тому +2

      @@elixirmentor haha you got me on that one. Trying to use elixir more for the GenServer stuff. Kinda leaving the frontend stuff for maybe something that’s already solid right now. Just from the past couple of months of me taking courses and watching your channel. So using phoenix just for the backend stuff 😂 is exactly what I need it for.

  • @jwrIII
    @jwrIII Рік тому +1

    Your thumbnails are killing me bro 😂 there's at least one guy out here appreciating the extra effort!

  • @tikkydore6973
    @tikkydore6973 Рік тому +1

    Thank you! Wonderful video. I just had to work on this for a school project and your video really helped me a lot!
    Please keep up the great work

  • @krzyczak
    @krzyczak Рік тому +2

    Man, this tutorial seriers is awesome! Coming from Rails and needed exactly something like that know what goes where in Phoenix to kickstart. Thanks a lot for this!

  • @guledomer
    @guledomer Рік тому +3

    Very excellent video it was exactly what I needed i just wanted a nice tutorial to set up a phoenix app as a json api server and exclude all the html and js stuff so that i can use my own frontend well done looking forward to the rest of this series.

  • @DominicanRepublicInvestment
    @DominicanRepublicInvestment Рік тому +3

    Hi again!!
    Excellent video, keep up the great work!!

    • @elixirmentor
      @elixirmentor  Рік тому +1

      I appreciate the support, thank you!

  • @alexo_27
    @alexo_27 Рік тому +1

    Thank you very much for the tutorial!

  • @tomeuestrany8553
    @tomeuestrany8553 Рік тому +1

    Thank you so much, super useful tutorial!

  • @FreedomVillage23
    @FreedomVillage23 Рік тому +1

    Awesome tuts brother! Thank you :)

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

    watching 3rd vid.
    excellent tutorial.
    thanks.
    request u to make a tutorial on chat application exactly like whatsaPP

  • @ianmjohn
    @ianmjohn Рік тому +1

    Feels nice to be 800th person sub.. great content btw

  • @amberxue2896
    @amberxue2896 Рік тому +1

    This is a great series of videos for beginners of elixir and pheonix. Just have one question that why you want to use separate tables for users and accounts?

    • @elixirmentor
      @elixirmentor  Рік тому +2

      Thank you, happy to hear that!
      I like to separate essential data and nonessential data. The account is everything required/necessary for our API so that we can use it for authentication, payments, and relationships with other tables (less user-facing data, but needed). Then I like to use the user table for all user-facing information, like name, age, gender, bio, and maybe a profile image. Still, all the user data is optional for accessing our API.

  • @borodark
    @borodark Рік тому +1

    10x! great style and awesome delivery! One comment: the construct %{email: } is an Elixir Map not JSON of any kind.

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

      Haha, thank you for your comment and for catching that! You're absolutely right, and I must've been too excited about Elixir that I started seeing JSON everywhere, including maps! 😄 I promise I've been working on this and my recent videos should reflect that - less "word jumbling", more accurate programming terminology. Let's call it my version of a software update! Keep the feedback coming, it's always appreciated.

  • @eletricalengineering101
    @eletricalengineering101 10 місяців тому +1

    Thanks!! How to add swagger to a phoenix rest API?

    • @elixirmentor
      @elixirmentor  10 місяців тому

      Swagger would be a good addition, maybe a mini series.

  • @hirakhax
    @hirakhax 6 місяців тому +1

    We should hash password in backend for security reasons or use any social authentication

    • @elixirmentor
      @elixirmentor  6 місяців тому

      It's important to hash passwords on the backend to ensure they're not stored in plain text. Even if you hash them on the front end, it's still necessary to hash them again on the backend to ensure maximum security.

  • @AlexanderRoempke
    @AlexanderRoempke Рік тому +1

    This is so cool

  • @AlexanderRoempke
    @AlexanderRoempke Рік тому +1

    i love your videos

  • @louiseyousre
    @louiseyousre 7 місяців тому

    ( 08:23 ) Hey bro .. hold your horses 😂 «you now understand what's the fu**... phoenix...». Great Video btw

    • @elixirmentor
      @elixirmentor  7 місяців тому +1

      🤣
      thanks glad you enjoyed it!

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

    Hello, i have problem with migration at 18.08.
    mix say that:
    ** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "account" does not exist
    but i see it, there is

    • @elixirmentor
      @elixirmentor  Рік тому +1

      This error message indicates that a table named "account" does not exist in the Postgres database associated with your Elixir project. This can happen for a number of reasons, such as the table not being created or not being migrated to the database.
      To resolve this error, you may want to check if the table exists in your project's schema file, and if it has been migrated to the database. If the table exists in your schema file but hasn't been migrated, you can run the migration command to create it in the database (`mix ecto.migrate`).
      Additionally, you can check if there are any typos or errors in the table name, or if the table was accidentally dropped from the database. In this case, you may need to recreate the table or restore it from a backup if available.
      If you're still encountering issues, you may want to check your project's database connection settings to ensure that it is correctly pointing to the database where the table is expected to exist.

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

    What's the app used for uml diagram?

  • @patric308
    @patric308 4 місяці тому

    I explained to my team about hashing password in the frontend and they laughed at me '-' could you explain me more why to do this? Is this a common practice? I've worked at two companies so far and neither of them did this

    • @elixirmentor
      @elixirmentor  4 місяці тому +1

      Frontend password hashing isn't about improving my server's security but protecting users who reuse passwords across multiple sites. By hashing the password client-side before sending it over HTTPS, we prevent the actual password from being transmitted. This way, even if there's a man-in-the-middle attack, the intercepted data can't be used to access the user's accounts on other platforms where they might have used the same password. It's an extra layer of protection against credential reuse, not a replacement for proper server-side security practices.

    • @patric308
      @patric308 4 місяці тому

      @@elixirmentor Nice explanation! Thanks

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

    My view folder didnt get created :?

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

      It could be many things. I'd rewatch the 2nd and 3rd videos and ensure you got everything. I'd love to have you in my discord, the most accessible spot to help with coding questions.

    • @sbodezzi00
      @sbodezzi00 Рік тому +1

      i have this problem too, i think it's related to the new upgrades from phoenix 1.6 to 1.7

    • @whisperscribe
      @whisperscribe Рік тому +1

      ​@@sbodezzi00 same here, I did some research and the Phoenix 1.7 is now View-less, so some folder structure and how to do stuff changed a bit, going to try to follow and see if I can do it anyways

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

      Yes, no view. How have you handeled it?

    • @elixirmentor
      @elixirmentor  Рік тому +8

      With Phoenix 1.7, you'll find your views in the controller directory with a suffix of _json.ex.

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

    Audio is clipping.