Giter VIP home page Giter VIP logo

connect-pg's People

Contributors

jebas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

connect-pg's Issues

Invalid query for session destroy.

this.getClient(function(err, client, done) {
  if (err) return fn(err);

  client.query('DELETE FROM ' + _this.table + ' WHERE sid = $2;', [ sid ], function(err) {
    done();
    if (err) return fn(err);
    fn();
  });
});

Postgres can't find $1 parameter and invoke error. If you replace $2 to $1 it will work.

Thanks.

Correct example for new version of node-postgres

As of version 1.0 of node-postgres, the pg.connect callback now returns a 'done' callback which one needs to use to return the client object to the connection pool.

var pg = require('pg');

function pgConnect (callback) {
    pg.connect('tcp://nodepg:password@localhost/pgstore',
        function (err, client, done) {
            if (err) {
                console.log(JSON.stringify(err));
            }
            if (client) {
                callback(client);
                done();
            }
        }
    );
};

originalMaxAge and expires are null

Hi there,

I'm using express.js in conjunction with connect-pg.
I want these sessions to expire within a reasonable amount of time, so I tried setting them to 1 hour, just for kicks.

    app.use(express.session({
        store: new pgStore(pgConnect),
        maxAge  : new Date(Date.now() + 3600000), //1 Hour
        expires : new Date(Date.now() + 3600000), //1 Hour
        secret: '@ky.jF8VBhR2[?tMqR9M6N4;Ek9b%tChxPtoTWFF'
    }));

It seems that the maxAge and expires that are set in express are not honored in connect-pg.
Below is a sample row from the output from psql when I take a look at the contents of the session table

"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"

I believe it's a bug, but then again I'm new to node, so I could be missing something.

new session is created for each call

I already had a working code storing connect session to a noSQL backend. I wanted switch connect-pg. But each call generates a new session. What could be the reason? Seems everything works, even the data that I attached to the session is stored in the database, but each call generates a new session. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.