Server Side Rendering with EJS and Node.JS

Поділитися
Вставка
  • Опубліковано 4 січ 2025

КОМЕНТАРІ • 121

  • @shi-nee7966
    @shi-nee7966 Рік тому +69

    another day of me feeling sorry for the kids like me who wanna learn backend but dont know about THIS GEM on youtube ooooofe

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

      Well we all are gems general engineering males 😂

    • @anshpradhan1954
      @anshpradhan1954 8 місяців тому +3

      you know what, what u just said is absolutely and prolifically true my friend, i was a noob in backend until i stumbled upon this playlist, Piyush is so good at explaining even the toughest concepts in node, which other you tubers just skip past.

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

    00:01 Server Side Rendering renders the entire web page from the server.
    02:05 Templating engines in server side rendering solve the server side problem by reducing code complexity.
    04:16 Using EJS as a templating engine for server-side rendering
    06:34 Setting view engine and creating views folder for EJS files
    08:27 Configuring Views Path for EJS in Express
    10:26 Create an LI tag with the URL ID for server-side rendering with EJS and Node.JS.
    12:34 Setting up a static router for serving front end pages.
    14:42 Implementing form and handling post requests in Node.JS
    17:22 Implementing server-side rendering and handling JSON response in Node.js with EJS.
    19:41 Configuring ports and rendering pages
    21:19 Creating a dynamic table in EJS
    23:49 Server side rendering with EJS and Node.JS makes rendering and serving data to the front end easier

  • @HarshvardhanSankpal
    @HarshvardhanSankpal Місяць тому +4

    one edge case u missed is that if we generate shortId for the same redirectUrl it generated 2 shortids, to solve this we can check in our db that if user has already requested shortId for that original url previously if yes serve him the same url and dont generate new shortID, good lec btw piyush bhai

  • @intensifyprakhar
    @intensifyprakhar Рік тому +49

    By default VSCode does not have syntax highlighting for EJS template files. You need to install a plugin like this one - EJS language support.
    You also need to configure the file association for .ejs files. In order to do so type the following command (using CTRL + SHIFT + P) - Change language mode and then select Configure file association for .ejs, then select HTML from the dropdown.

  • @pallabdandapat1866
    @pallabdandapat1866 7 місяців тому +2

    The best thing i love the overall explanation of the flow . 💘

  • @nextleveltech267
    @nextleveltech267 5 місяців тому +3

    Thank you so much...❤️❤️ You explained it so nicely and this is so informative...❤️❤️

  • @tarunbuser
    @tarunbuser 11 місяців тому +7

    (FIXED)the shortIds are not showing when calling from ejs file. The html document is giving blank elements without shortId.
    : EDIT :
    Ok I was dumb to see a = in the syntax. I was doing without this =. This does not give any error thats why it took me time to notice.

  • @ShubhamPatil-rr4on
    @ShubhamPatil-rr4on Рік тому +4

    Bhai you are doing amezing ♥️

  • @elontweets2139
    @elontweets2139 2 місяці тому +1

    Tip: Before starting read about SSR & CSR, What is view engines and view etc, after that you will be able to follow this tutorial easily.

  • @045shots
    @045shots 15 днів тому +1

    bhai backend se dar lagta tha lekin ye toh frontend se easy lag raha muje

  • @VishalMishra-ls5vc
    @VishalMishra-ls5vc Місяць тому

    hope this video will reach every tech student out there🤞🤞

  • @Vivek-rn9zb
    @Vivek-rn9zb Рік тому +2

    Great tutorial keep it up bhaiya

  • @pradeepKumar-rf9qb
    @pradeepKumar-rf9qb Рік тому +1

    best tutorial with great explanation..

  • @poojaganvir5631
    @poojaganvir5631 11 місяців тому +1

    Great explanation, thank you so much

  • @timletotewes7017
    @timletotewes7017 10 місяців тому +5

    Is there any (sensible) way of combining this with react & a modular structure?

    • @duztv5370
      @duztv5370 9 місяців тому +1

      Hi! Have you been able to figure it out?

    • @Lauchmeister
      @Lauchmeister 9 місяців тому +1

      You use React + React router for rendering & routing & for communication between React & Node you send fetch requests from react to the IP of your Node server. However, this won't be server side rendering anymore of course.@@duztv5370

  • @Gladiator_TV
    @Gladiator_TV 10 місяців тому +6

    sir can we use JSX to do server side rendering?

  • @VishalMishra-ls5vc
    @VishalMishra-ls5vc Місяць тому

    great explanation sir

  • @RahulYadav-jk7um
    @RahulYadav-jk7um 6 місяців тому +2

    One of the best youtuber

  • @syedanoor-x6j
    @syedanoor-x6j 2 місяці тому

    you r master mind wish u best of luck you gave me such a big support

  • @User-yb3yc
    @User-yb3yc 6 місяців тому +2

    Great content Bhaiya. Pls also provide source code its hard to code and learn at same time

  • @RohitKumar-dy2gc
    @RohitKumar-dy2gc 10 місяців тому

    amazing bro✨✨

  • @shubhamgupta-bl1tr
    @shubhamgupta-bl1tr Рік тому +3

    What is difference between making a ui with template engine and with frontend library like react and next js ?

    • @Black-Curtains
      @Black-Curtains Рік тому +1

      With ReactJs and NextJs, our web pages get loaded component-wise, without page reloading. I believe we reload webpages or urls in node.

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

      I have already covered this in my REST API video in this playlist itself. Thanks ✨

  • @technologicalvivek7510
    @technologicalvivek7510 10 місяців тому +2

    I have doubt.Frontend alag rakho backend se ,front-end ke liye ek hi project directory me folder banao or usme front-end ka code likh do using any framework like react js or angular js.Ye ejs karne ki kya jarurat

    • @tiwarikanishk5366
      @tiwarikanishk5366 10 місяців тому +2

      server side rendering dynamic websites k liye boht fast hoti hai , frontend me api's ko data lana phir load krna ye sab boht time consuming hai

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

    No default engine was specified and no extension was provided.
    ye error a raha h how to resolve??

  • @Omarfaruk-wq5hl
    @Omarfaruk-wq5hl 29 днів тому

    Thanks for this sires

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

    Action='/url' this part is creating the problem. Upon clicking on generate button nothing is happening. Plz help plz help

  • @ShivamKendre-fc3su
    @ShivamKendre-fc3su 2 місяці тому

    Great video

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

    Great video ❤

  • @chiraglimbachiya2688
    @chiraglimbachiya2688 5 місяців тому +1

    nice video. thanks

  • @wrestling_world_007
    @wrestling_world_007 5 місяців тому +1

    How to connect nodejs with Angular

  • @shashwatsingh2748
    @shashwatsingh2748 11 місяців тому +2

    How do i pass objects from EJS File to back-end Route ?

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

    I have a question. When you are rendering the home page with shortid from the handleGenerateNewShortURL function, the path on the address bar is localhost:8001/url but i want it localhost:8001/ (the same url which is used to render home page). How do I do that? Just give me a basic idea please.

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

      bhai same dought mera bhi hai, ager aapka solve ho gya ho to kya code mil sakta hi🙏🙏

    • @ghost10326
      @ghost10326 11 місяців тому

      @@akhileshsingh0136 Mila kya bhai ?

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

      ​@@ghost10326Same doubt.Did you get the solution?

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

      Okay what you can do is you can update your form action = "/" and at static router add another route for a post request like you have done in this localhost:8001/url at the function in your controls there instead of only passing id as object pass url by URL.find({}) then it will work for you

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

    you are gem instructor

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

    what is the extension for ejs snippets?

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

    Why for home.ejs import is not necessary?

  • @arshitcc
    @arshitcc 5 днів тому

    amazing

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

    Not understanding not working these program uu created wrong but u change in not showing in video so that's way it is not working code mismatched......

  • @AbcdEfgh-pu6nq
    @AbcdEfgh-pu6nq 4 місяці тому

    Ejs me seperate css or js file banti he kya or banti he to kese please batao

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

    home.ejs mai urls.foreach mai urls not defined aara hai ...error giving , tried everything chatGPT , still not able to correct it

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

      for in loop use kar bhai

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

      @@lethalwarrior7 bhai for in loop kaise use kare isme for in ka syntax hi nhi hai

    • @AyushSingh-lp8wi
      @AyushSingh-lp8wi Рік тому

      Did you solved this error? I am stucked in it

    • @tarunbuser
      @tarunbuser 11 місяців тому

      @@AyushSingh-lp8wi use this inside your "/test" route function. You should name the variable correctly before passing it to ejs file:
      return res.render("home", {
      urls: allUrls,
      });

    • @AkshayKapse-r7y
      @AkshayKapse-r7y 2 місяці тому

      ​@@tarunbuser I tried but the problem was not solved. Please help 3 din se kosis kr rha hu but ho he nhi rha.....😵‍💫

  • @ShivamAgrahari-c2d
    @ShivamAgrahari-c2d Рік тому

    i have been following you for this playlist
    and i build same endpoints for post(making new url) and get(get all shorturl from database) that is '/' now i get an error whenever i use call for '/' in my browser then it shows a error which is in post request(as i tried to recall the same posted data in it using await) ans using console.log to print its timestamp just for fun,
    the error tells me that this timestamp is null
    and when i changed the url from '/' to '/url' for get and '/cal' for post the error was resolved
    as the browser only calls for get then why is this happening?

    • @ASD-mt4mf
      @ASD-mt4mf 8 місяців тому

      i faced the same issue. when my router was "/url" my ejs was not getting passed and i was getting the same error as yours: timestamp is nulll. So i also changed the route to something else and then it worked.
      did you find why it was happening?
      im confused

  • @NCoder03
    @NCoder03 11 місяців тому +2

    Ahhhh! I'm getting this error for 4 days 🤮 TypeError: Cannot read properties of null (reading 'redirectURL')

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

      i was also facing the same issue but the mistake was in updating visitHistory

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

      mee too same...@piyushgarg bhaiya please help

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

      If you are facing error then try to solve it by own and give time to think that what is the issue in it . Still, you are facing error then dont waste 4 days to just solve that error . So should use the chatgpt and give the command or just copy the error and paste in it. Your issue will be solved

    • @iamkashyapkumar
      @iamkashyapkumar 9 місяців тому +3

      In index.js, change app.get("/:shortId",.......) to app.get("/url/:shortId", .........). This is happening because there two functions defined for / path, one is / and another one is /:shortId

    • @LG.KILLER
      @LG.KILLER 9 місяців тому

      hello
      check your shortid(if any word capital or small) name in schema write same name in app.get when u fetch shortid

  • @ZiaUlislam-do8iy
    @ZiaUlislam-do8iy 8 місяців тому

    Aslamullakum Sir I am new in node and start learning from your course and face the problem when I create Short id of given URL, it create only one url short id when I put another Url i will show E11000 key duplication how I can get rid this issues Sir

    • @rana.safikhan
      @rana.safikhan 5 місяців тому

      unique true kiya hoga apne schema mein, aur kya same domain enter kr rhy thy?

  • @yourhonestbro217
    @yourhonestbro217 3 місяці тому +2

    No hate but I don't know why people just fall in love with every tutor, although appreciation is good but going to extremes for just buttering people is not good

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

    sir source code error aa rha hai

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

    Thanks bro

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

    If nodejs can return Ui then why we need reactjs?

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

      this is server side rendering, when you want to do client side rendering we use frameworks like react and angular

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

    Can you provide source code link for this lecture I am getting an error.

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

    sir ye samajh nahi aya ki staticRouter kyu banaya , jab ki samework uske bina bhi ho sakta tha

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

      Static Router is just for rendering pages, rest all handling POST, API requests.

  • @polymath-403
    @polymath-403 Рік тому

    thanks man

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

    ye wala sach me khatrank tha

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

    ZABARDAST!!!!

  • @jashanpreet.753
    @jashanpreet.753 7 місяців тому

    10:30 recap

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

    You have made it very complex to understand i saw each and every videos but You are still working on same file that's create problem to understand how does code work. pls make separate files for understanding.

  • @WaseemAkram-tc9tl
    @WaseemAkram-tc9tl Місяць тому +3

    Sorry to say but this one is quite difficult

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

    Bhai thora dheere dheere bataya karo bhai hum beggeners ko smjhne m thora time lagta hai

  • @Akshay-be3xt
    @Akshay-be3xt 9 місяців тому +2

    anyone give source code

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

    Guys if someone had complete code for this particular lecture then pls kindly let me know .

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

    Very complex code. he has edited some important part of code thats why not runs properly

  • @theonly_ashu
    @theonly_ashu 2 дні тому

    3:50

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

  • @EdwardSmith-h2s
    @EdwardSmith-h2s 3 місяці тому

    Lamont Turnpike

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

    bro source caode de diya kro pls

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

    vid-22 ✅

  • @akshaysaini001
    @akshaysaini001 11 місяців тому

    source code send krdooo

  • @kartikverma6412
    @kartikverma6412 29 днів тому

    made it......✔✔

  • @PrabalVerma-iy7yz
    @PrabalVerma-iy7yz 9 місяців тому +1

    bro has given his girlfriend link in description💀💀

  • @Jordan-o6c1t
    @Jordan-o6c1t Рік тому +1

    code dedo bhai

    • @BOSS-fc9lj
      @BOSS-fc9lj 11 місяців тому

      yess plzz give the source code beacause my typed source code is giving error

  • @TannuSuvarnakar
    @TannuSuvarnakar 11 місяців тому

    Sir please source code de do

  • @kuchbhi-to2ru
    @kuchbhi-to2ru 4 місяці тому

    bhai adhe video me se kaha pe gayab ho gaye he😂😂

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

    Don't write the title in English if you're not going to speak English 😒

  • @salexkorsan8790
    @salexkorsan8790 Місяць тому +2

    Is say accha to php h yrr

  • @TechnologyRelatedStuff
    @TechnologyRelatedStuff 5 місяців тому

    another day of me feeling sorry for the kids like me who wanna learn backend but dont know about THIS GEM on youtube ooooofe

  • @AkshayKapse-r7y
    @AkshayKapse-r7y 2 місяці тому

    home.ejs mai urls.foreach mai urls not defined aara hai...error giving, tried everything chatGPT, still not able to correct it