Coding

Node.js + Express – Tutorial – What is Express? And why should we use it?

  • 00:00:01 hi everyone welcome back great to see
  • 00:00:03 you here
  • 00:00:04 so we already played around with node
  • 00:00:07 quite a bit we send responses we render
  • 00:00:10 HTML and we created our own routing
  • 00:00:12 let's have a look at that routing for
  • 00:00:15 example so here in my app touch as file
  • 00:00:19 this is how the routing looks like now
  • 00:00:25 this works fine but as you can see
  • 00:00:28 that's a lot of code for what for
  • 00:00:31 Chester Rally for just getting the path
  • 00:00:33 and sending a response and just would
  • 00:00:36 get even more complicated if we were to
  • 00:00:38 add some some middleware some checks and
  • 00:00:41 so on so when working with no chance on
  • 00:00:45 its own with pure notes yes we have to
  • 00:00:48 write everything on our own like we do
  • 00:00:50 have to do this when we're working with
  • 00:00:52 pure PHP for example without any
  • 00:00:55 framework every logic parsing routes or
  • 00:01:00 passing URLs and creating routing
  • 00:01:03 actions all checks rendering everything
  • 00:01:06 has to be written by ourselves notice
  • 00:01:08 it's not only annoying it's also
  • 00:01:11 error-prone it might be insecure and so
  • 00:01:14 on we should focus on a business logic
  • 00:01:17 and not on the repetitive tasks of well
  • 00:01:21 for example parsing URLs and setting up
  • 00:01:24 routes in this way we're doing it right
  • 00:01:27 here
  • 00:01:28 so therefore it we're using frameworks
  • 00:01:31 in well pretty much all languages right
  • 00:01:33 in PHP we might use wearable which you
  • 00:01:36 can also find in this channel here a
  • 00:01:38 node a very popular framework but not
  • 00:01:41 the only one to say that is Express
  • 00:01:44 Express built upon node and it just
  • 00:01:48 offers us a lot of tools which make
  • 00:01:52 writing node apps more fun easier it
  • 00:01:56 implements a lot functionalities that
  • 00:01:58 will take care about all that
  • 00:02:00 nitty-gritty stuff here and allow us to
  • 00:02:03 focus on a business logic to quickly set
  • 00:02:06 up routes to easily render stuff to
  • 00:02:09 scream and
  • 00:02:10 on so this is what Express does and for
  • 00:02:16 example Express also allows us requires
  • 00:02:19 us to use templating engine to create
  • 00:02:21 our HTML files to dynamically inject
  • 00:02:25 values into these files and so on so it
  • 00:02:27 really covers a lot of things we want to
  • 00:02:30 do on our own I realize and which would
  • 00:02:32 be very annoying and it does so in a
  • 00:02:34 fast and optimized and secure way
  • 00:02:37 therefore using such a framework be it
  • 00:02:40 Express or any other node framework it's
  • 00:02:42 definitely a good idea for the rest of
  • 00:02:45 this course for the next videos we'll
  • 00:02:48 use Express and in the next video we'll
  • 00:02:52 start by setting up Express and going
  • 00:02:55 food basic folder structure we'll have
  • 00:02:58 in Section Express app see you then bye