Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7956243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:56:03+00:00 2026-06-04T03:56:03+00:00

is there some simple example how to use cookies or sessions in towerjs? I

  • 0

is there some simple example how to use cookies or sessions in towerjs?
I read about Connect Middleware, but I have no experience with it (and unfortunately with node.js also).

If examples are not available I will be grateful for any tips too.

Marcin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:56:05+00:00Added an answer on June 4, 2026 at 3:56 am

    Cookies

    From the TowerJS source code here, the controller has these properties:

    • @request
    • @response
    • @cookies (which is just a shortcut for @request.cookies)
    • @session (which is just a shortcut for @request.session)

    Hence to set cookies you can follow express documentation here

    For example this set cookie ‘rememberme’

    # "Remember me" for 15 minutes 
    @response.cookie 'rememberme', 'yes', 
      expires: new Date(Date.now() + 900000)
      httpOnly: true
    

    And to get the cookie

    @request.cookies.rememberme
    

    Session

    As for session, looks like it’s just connect in memory session. See source code here
    https://github.com/viatropos/tower/blob/master/src/tower/server/application.coffee#L39

    So you can just use it like:

    @request.session.something = 'something'
    

    or

    @session.something = 'something'
    

    Ok hope that helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It feels like there must be some semi-simple solution to this, but I just
There are some different opinions about simple inner classes, so I was wondering if
Simple query, possibly impossible but I know there are some clever people out there
Is there a simple way, without .NET? I've found some libraries but none for
Is there some simple way to send out a ping-style message to a remote
I am working on a cms and there are some simple parameters like number
I was searching Google for a page offering some simple OpenMp algorithms. Probably there
In my current simple project, Copybin , there is some space at the bottom
Is there any (simple) way to get some control of the order in which
is there a simple way to persist some of the fields in another class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.