correct way to write cookies from the server side

General Discussion
  • I would like to make my NodeBB forum to write a cookie when the

    I found the function that is executed when user is logged in successfully: authenticationController.onSuccessfulLogin.

    How to make this function also to write a cookie?

    I tried to guess, but it did not work:

    req.cookie('loggedin', '1');
    res.cookie('loggedin', '1');
    

    Also I would like this cookie to be removed when the user is not logged in.

    I need this cookie in order to make another layer of caching (for non-logged in users) using Nginx and to test how it will work.

    Is it possible this to be made by a plugin?


Suggested Topics