Express JS #13 - Sessions Pt. 1

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

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

  • @xx-fw1yq
    @xx-fw1yq 4 месяца назад +1

    Probably the best video i've seen explaining this. Thanks a lot.

  • @robertoaraujo6367
    @robertoaraujo6367 11 месяцев назад +3

    Best tutorial.

  • @danielouattara3857
    @danielouattara3857 10 месяцев назад +1

    Thank you Anson for the material you provide to all of us.
    In this course Anson artificially alters the session object in the index.js, at `app.get('/', ...)`, so that when he makes a request using development tools like `thunder client` or `postman`, the output of `console.log(req.sessionID)` will always be the same on any request. This tries to justify how applications sever can keep track of user for subsequent requests. Cool !
    And the game is totally different on a real web browser: there, developers don't have to do anything on the session object and the sessionID value will remain the same. Am I wrong Anson ?

  • @hasibalfuad9652
    @hasibalfuad9652 11 месяцев назад +3

    Great content. Can you please tell What is the theme and the font you are using?

    • @muthanaalahmad5843
      @muthanaalahmad5843 8 месяцев назад

      i think it is monolisa, u can use cascade mono as it is free

  • @starrynight72
    @starrynight72 3 месяца назад

    So in the real world development, we have to modify the session object manually to keep the sessionId to be same?

  • @yurikanaeru634
    @yurikanaeru634 11 месяцев назад +1

    thank you very much

  • @khalid-bin-waleed2674
    @khalid-bin-waleed2674 3 месяца назад

    i don't understand how server will identify who the user is. i understand when user will first visit a website, server will send a session id to client and client will send the session in each subsequent request to server. but how server will recognize who the user actually is? what the role of the user, is he authenticated or not? i will appreciate the clarification. thank you.

  • @josephkoh1562
    @josephkoh1562 11 месяцев назад

    hey anson i have a qn... So for example, when u visit the ecomm web app how does the app knows whether to render an admin login page or user login page? As i know usually there is a different login page based on the user role like admin and user

    • @ansonthedev
      @ansonthedev  10 месяцев назад +2

      Usually you'd setup roles for a user on the server side, and the client side will see the roles property when the user data is fetched. If the user is trying to visit an admin page or restricted page, you want to check if they have the correct role first before granting access.

  • @GabrielYasso-og7zc
    @GabrielYasso-og7zc Месяц назад

    thanks.

  • @abdullhaseeb4157
    @abdullhaseeb4157 6 месяцев назад +1

    for me without setting session.visited = true the session id is same , is that a problem?

    • @durubhuru
      @durubhuru Месяц назад

      that can't be possible because in options when we declared session middleware it states that if session isn't modified it shouldn't be saved

    • @durubhuru
      @durubhuru Месяц назад

      I think you made some problems with middleware options

  • @kuruxxii
    @kuruxxii 8 месяцев назад

    excellent

  • @uni8380
    @uni8380 9 месяцев назад +1

    even with the visited set to true , its still generating new sessions for the same requests

    • @ansonthedev
      @ansonthedev  9 месяцев назад +1

      Check your Session config again.

    • @uni8380
      @uni8380 9 месяцев назад +1

      @@ansonthedev i fixed it . thanks

    • @hugosenee2504
      @hugosenee2504 8 месяцев назад

      Hi ! I have the same problem, can you tell me how did you fix it please ?

    • @am1rn
      @am1rn 7 месяцев назад

      @@hugosenee2504 just put your code that related to session at chatgpt and tell it why its still generate a new session even though the visited set to true and make an explanation about it. ChatGPT is my best friend lol.

    • @echendukwe1510
      @echendukwe1510 6 месяцев назад

      @@uni8380 how did you fix it please.

  • @echendukwe1510
    @echendukwe1510 6 месяцев назад

    Hi, lovely video but i do get a cookies
    error in production

    • @ansonthedev
      @ansonthedev  6 месяцев назад

      I don't know how to help you if you don't provide the error you have.

  • @mohmmaadsd6703
    @mohmmaadsd6703 Месяц назад

    ypur best broo

  • @tarunkatal3389
    @tarunkatal3389 11 месяцев назад

    Slides are too fast in start.. o/w HQ content❤