You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
Hi! We use this module without connect. See here for an example.
But basically you can just pass the req and res objects from node's http.createServer to the client session handler.
varsessions=require("client-sessions");varhttp=require('http');varrequestSessionHandler=sessions({cookieName: 'mySession',// cookie name dictates the key name added to the request objectsecret: 'blargadeeblargblarg',// should be a large unguessable stringduration: 24*60*60*1000,// how long the session will stay valid in msactiveDuration: 1000*60*5// if expiresIn < activeDuration, the session will be extended by activeDuration milliseconds});http.createServer(function(req,res){requestSessionHandler(req,res,function(){if(req.mySession.seenyou){res.setHeader('X-Seen-You','true');}else{// setting a property will automatically cause a Set-Cookie response// to be sentreq.mySession.seenyou=true;res.setHeader('X-Seen-You','false');}});}).listen(8000);
I didn't test this example, but it should show you how it can be done.
..maybe there are better ways to use client-sessions without connect?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please can client-sessions be used with Raw HTTP(s)?
The text was updated successfully, but these errors were encountered: