Sha256: e6a4b6272303559344a033bda34d19ef7469dc3d07cf63d3b3b6c7a614a87b2a

Contents?: true

Size: 707 Bytes

Versions: 28

Compression:

Stored size: 707 Bytes

Contents

/*!
 * Connect - query
 * Copyright(c) 2011 TJ Holowaychuk
 * Copyright(c) 2011 Sencha Inc.
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var qs = require('qs')
  , parse = require('url').parse;

/**
 * Automatically parse the query-string when available,
 * populating the `req.query` object.
 *
 * Examples:
 *
 *     connect(
 *         connect.query()
 *       , function(req, res){
 *         res.end(JSON.stringify(req.query));
 *       }
 *     ).listen(3000);
 *
 * @return {Function}
 * @api public
 */

module.exports = function query(){
  return function query(req, res, next){
    req.query = ~req.url.indexOf('?')
      ? qs.parse(parse(req.url).query)
      : {};
    next();
  };
};

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
blackboard-3.1.9 lib/site_template/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.8.2 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.8.1 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.8.0 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.7.2 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.7.1 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.7.0 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.6.1 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.6.0 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.5.0 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.4.0 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.3.0 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.2.5 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.2.4 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.2.3 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.2.2 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.2.1 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.2.0 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.1.6 server/node_modules/express/node_modules/connect/lib/middleware/query.js
vulcan-0.1.5 server/node_modules/express/node_modules/connect/lib/middleware/query.js