Build RESTful Web APIs with Shelf_router (Dart Package of the Week #10)

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024
  • ХоббиХобби

Комментарии • 56

  • @TadeuCS
    @TadeuCS 3 года назад +1

    this is a very completed video, congratulations!!!

  • @giancristian2265
    @giancristian2265 3 года назад

    awesome class...congratulations!

  • @romegab
    @romegab 3 года назад +1

    Excellent clear video thank you!

  • @dkvirus868
    @dkvirus868 2 года назад

    Good.Good.Good.

  • @erlend1587
    @erlend1587 3 года назад +4

    Thank you for making these great tutorials! I've been using Dart in my latest project for serving http / websocket requests. I think i will port it to shelf now. I really enjoy Dart as a server language; fast to start up and type safe. I hope it will gain more recognition as a server language and grow a bigger community. I see it as a strong competitor to frameworks like node / deno / vapor etc.

  • @abnnersales2670
    @abnnersales2670 4 года назад +5

    This video is so helpful, I'm thank you for that, keep going mam🔥

  • @zenalex2004
    @zenalex2004 4 года назад +1

    Thank you for your video! It will be cool if you show how to build RESRful Web API with authoriztion and authentification. For example, with JWT tokens.

    • @CreativeBracket
      @CreativeBracket  4 года назад

      Cheers Alexey! I do have a short series on registration and authentication here ruclips.net/video/HloDTrNH37c/видео.html

  • @panthpatel3066
    @panthpatel3066 3 года назад +1

    could you make a video about querying from a mysql database

  • @gnrslashsp6501
    @gnrslashsp6501 2 года назад

    Hey, this was the most detailed video I've seen, congrats! Just a question: how to deploy dart web apis on IIS with Windows? or it can't be done and we must start the console app?
    And my second question is: to access MSSQL stored procedures, is there any packages available, because in dart web api, I'll need it =]

    • @CreativeBracket
      @CreativeBracket  2 года назад +1

      I suppose you could either:
      1. Compile your Dart app as an executable and run that executable via IIS
      2. Run the Dart server as a separate process and configure an IIS reverse proxy forwarding requests to that Dart process

  • @rumpeldrump
    @rumpeldrump 3 года назад

    Great tutorial. Little hint, there are a lot of Rest plugins for vs code.

  • @samuel.dubovec
    @samuel.dubovec 3 года назад

    Hi, good video.
    It would be awesome to cover oauth2 implemented on shelf server in future.

  • @joaopedrojanuario6968
    @joaopedrojanuario6968 3 года назад

    This is so cool!, but why pass handles ( ) try pass turn to json ?({"name": name ) for example.

    • @CreativeBracket
      @CreativeBracket  3 года назад

      Capturing the path parameter as a variable allows us to create sets of related urls (/user/john, /user/jane, /user/mary etc...) It's not common to pass a json string in the query string of a GET request and its rather done under a POST request.

  • @ccvx4dfdf4gf4
    @ccvx4dfdf4gf4 3 года назад

    Hello Jermain, you are a great teacher and I see that you answer any question here in the comment. Thank you. I wanted to ask you this: I want to run a server with flutter in my smartphone because i wanna use some flutter packages in my project. I tried to run the simple endpoint of http get of "Hello world!", but despite i see the print "server running on port ecc..." and the app running, i can't access to that string in my browser or in postman. Have you any advice? Thank you.

    • @CreativeBracket
      @CreativeBracket  3 года назад

      Hello Domenico, haven't really tried running a Dart server directly in a Flutter app. I'd almost always suggest not doing that since if the server were to crash in some way then the app is rendered useless until a new package update is sent across.
      Why not run the server on the cloud and use one of the http packages to access that from the Flutter app? See my Flutter/MongoDB course for best approach to working with servers.

    • @ccvx4dfdf4gf4
      @ccvx4dfdf4gf4 3 года назад

      ​@@CreativeBracket Hi jermain, thank you very much for replying. Since I'm doing new things, sometimes I don't really know what I'm doing. Anyway, now I'm running the server as a flutter app in my smartphone with shelf. I'd like to know how to allow HTTP requests from any device on the web. I ask you if you can give me any suggestions or advice.

  • @stankokostic725
    @stankokostic725 Год назад

    Reading local JSON file does not work for me. I get the 'FileSystemException: Cannot open file (OS Error: No such file or directory, errno = 2)'
    Are we sure json can be read like this synchronously ??

    • @CreativeBracket
      @CreativeBracket  Год назад

      The error suggests you weren't referencing the file correctly

  • @princeanujk
    @princeanujk 3 года назад

    Bro Im Getting Internal Server Error for Getting Film List And post Film Request, After mouthing our films api....
    get specific film by id and delete film are working fine...

  • @qasimrailo5289
    @qasimrailo5289 2 года назад

    how we can handle Update or put request method

  • @Juliano-v
    @Juliano-v 4 года назад

    Great video! Thank you!
    i agree with alexey about the RESTful, i tried to handle the json object and it was too hard (my opinion)
    If you press "run" instead of "debug" it will create the rest as a "process in background", so even if you close VsCode it will keep running in "background", to end it, you need to access the task manager, search for "dart" and finishes it

    • @CreativeBracket
      @CreativeBracket  4 года назад +1

      Hey Juliano, thanks for your comment. Could you expand on what you found hard about handling the json object? On the "run" vs "debug"' I've just tested this myself and cant seem to reproduce it. Also worth mentioning that you will see a "dart" process in the task manager even when you have a Dart file open in VS Code, due to the intellisense thats happening in the background.

    • @Juliano-v
      @Juliano-v 4 года назад

      ​@@CreativeBracket Hey Jermaine, thank you VERY much for this video, i took a little more time using the shelf router, and maybe now i can, finally, try a backend in dart!
      - About the 'handling json' i didn't know that i should put the decoded var as Map to use its props.
      - About the 'run' vs 'debug', i have a "Code Runner" extension, idk if this is impacting the process, but i tried again today, and it kept the dart running even when i closed my vscode.
      - The class documentation helped a lot, i was searching how to change the status code (post route), and it was just put Response(201) 😍
      Please keep doing dart/flutter videos!

    • @CreativeBracket
      @CreativeBracket  4 года назад

      Cheers Juliano! I only use the Dart and Flutter extensions for VS Code, so "Code Runner" may be the issue here.

  • @its-lazlo-to-you
    @its-lazlo-to-you 3 года назад

    Any idea how to create a CORS middleware?

    • @CreativeBracket
      @CreativeBracket  3 года назад

      Hey Stephen, got this example for you gist.github.com/graphicbeacon/e9186517767f7a86c9d24e79a09b8c3a

  • @ModernMonk30
    @ModernMonk30 2 года назад

    is there anything like nodemon for nodejs in shelf to automatically restart the server whenever we save the file

  • @EricCopier
    @EricCopier 3 года назад

    Thanks for your video. It helped me very good. How do I deploy this WEBAPI on an IIS webserver? Is that possible? Thanks in advance!

    • @CreativeBracket
      @CreativeBracket  3 года назад

      Hey Eric, I haven't touched IIS for a while now. Easy route will be to launch your API as a standalone server and from IIS proxy requests to it.

    • @EricCopier
      @EricCopier 3 года назад +1

      @@CreativeBracket Thanks for your answer. Keep safe and keep up the good work .

    • @CreativeBracket
      @CreativeBracket  3 года назад

      @@EricCopier Cheers, you too :)

  • @erlend1587
    @erlend1587 3 года назад

    Could you make a tutorial how to combine the shelf_router with shelf_static ?

    • @CreativeBracket
      @CreativeBracket  3 года назад +1

      Cool, have you seen the current series I'm doing? I'm combining those ruclips.net/video/ZKNKNxaliZQ/видео.html

  • @rec-trick
    @rec-trick Год назад

    Is Shelf other than Shelf Router?

    • @CreativeBracket
      @CreativeBracket  Год назад +1

      Shelf Router is built on top of shelf, therefore installing shelf router adds shelf too

  • @kld0093
    @kld0093 4 года назад

    Is there an advantage to making apis using dart rather than node or python?

    • @CreativeBracket
      @CreativeBracket  4 года назад

      Off the top of my head you can compile your server side Dart code as an executable and deploy that without the need of the Dart runtime. Also saves the you from context-switching when building backends for Flutter apps. Doesn't mean Node and Python are bad options btw

    • @CreativeBracket
      @CreativeBracket  4 года назад +1

      I'd also add that you get static typing baked into Dart with null-safety on the way :)

  • @heldim92
    @heldim92 3 года назад

    Hey man! Thank you very much for the video and constant dedication around dart! Your content is very useful!
    Currently, I am still kinda confused about some possibilities, and it would mean a lot if you could explain me a couple things...
    When it comes to mobile backend, I really wouldn't like to use the firebase/aws/azure solutions...I wish to implement my own backend in order to learn, however, I am always confused about what is supposed to be used for mobile and what's supposed to be used for the web apps...conceptual doubts, I'd say. Or is there simply no difference between mobile and web backend dev?
    Is this shelf_router solution appliable to mobile, or is there any exceptions? And compared to Angel and Aqueduct, which one out of the three would you recomend for the given context in 2021? Or none at all?
    Today, it looks like most entry-level devs don't even consider anything other than backend cloud-ready solutions when it comes to mobile, thus, being bounded to spend a lot of $$ as soon as their business grows...and this reflects the number of tutorials specifically aimed for this...

    • @CreativeBracket
      @CreativeBracket  3 года назад +2

      Hey Helder, backend dev usually refers to server-side infrastructure which can serve either mobile or web apps. This follows the client-server model described here developer.mozilla.org/en-US/docs/Learn/Server-side/First_steps/Client-Server_overview That being said, the shelf_router solution sets up a server with routes that can be accessed by either mobile or web apps via HTTP network calls.
      Angel has been deprecated by the author so that leaves Shelf and Aqueduct. Shelf is a lightweight solution which allows more flexibility with composing servers. Aqueduct is more robust and comes with some useful extras like the ORM for talking to PostgreSQL databases and better documentation. I reckon shelf will get you _closer to the metal_ if you wish to clear your conceptual doubts...

    • @heldim92
      @heldim92 3 года назад

      @@CreativeBracket Man, thank you very much for such a detailed answer! I will definitely check these two options and read that documentation, it will be of great help!! One last question, in terms of support for projects with commercial purpose, like freelancing or personal ideas to put in production, do you think Dart as server-side (aqueduct or shelf) is a good option for a beginner like me in terms of security, tools, etc, or should I, at least at first, pick Go or C#, for instance?
      By the way, congratulations on 5k, you deserve it! And please, keep the good work!

    • @CreativeBracket
      @CreativeBracket  3 года назад +1

      The Covid situation has slowed down development of the Aqueduct framework, so would use that in smaller projects, whether personal or commercial. Shelf is a good option moving forward, since the Dart team have been using it for the GCP cloud functions integration. I see 2021 being the year of server-side Dart development since it pairs well with Flutter development. Go or C# may be a bit heavy for beginners so I'll go for NodeJS.

    • @heldim92
      @heldim92 3 года назад

      @@CreativeBracket Thanks again for the fast reply! Just to make sure (I am strictly following your perceptions hahaha), when you say "bit heavy", you mean "hard", or "just a lot of unecessary tools" at first?
      Because speaking of the code itself, I'm actually used to C and its "pointers mess" (that's the main language used for projects where I study) however, the stuff I got involved with were absolutely non-related to web/mobile :x
      NodeJS is not an option since I'm trying to escape from javascript, so yea, either Dart or Go (or C#), I guess...although I am inclined to Dart in order to keep the same language as the frontend. I just wanted to make sure that I won't find a certain lack of packages/libs to accomplish the needed tasks.
      Am I really good to go with Dart Shelf?
      If so, I'll begin as soon as you confirm (and either way, I'll stick to the news here)! :D
      Sorry for extending this so much, it's just a lot of insecurities and usually not many good opportunities to clear doubts.

    • @CreativeBracket
      @CreativeBracket  3 года назад +1

      I meant "hard" when I said "bit heavy" but if you know C already then ignore that one. I guess Dart and Go make a good combination since they're both by the same company. I don't think it has to be one or the other. In terms of packages there are more options with Go, but Dart's package ecosystem is increasing daily. Dart is a good option if you're looking to build frontends with solutions like Flutter, AngularDart or Overreact. So in my opinion use Dart/Shelf for smaller projects and Go for mid/larger ones.

  • @sakethparimi7664
    @sakethparimi7664 4 года назад

    Can you do an overreact tutorial please?

    • @CreativeBracket
      @CreativeBracket  4 года назад

      Hey Saketh, thanks for suggestion, although I also want to encourage you to engage with the content that is presented. Why overreact?

    • @sakethparimi7664
      @sakethparimi7664 4 года назад

      Cause, react is is really popular and js library react doesn’t really have auto completion. Also, I don’t really like JavaScript

    • @sakethparimi7664
      @sakethparimi7664 4 года назад

      @@CreativeBracket how would you add html or a client to shelf?