query.js
This file
Path
lib/middleware/query.js
40 lines · 687 bytes · JavaScript
Last changed by
perf: enable strict modeDouglas Christopher Wilsonbefore adoptione71014f
History of this fileTake it
The walk stopped after 200 commits: lines older than 6bc7574 point at it.
docs: add license commentsDouglas Christopher Wilsonbefore adoption95ad276
lines 1–8why, one step back1/*!2 * express3 * Copyright(c) 2009-2013 TJ Holowaychuk4 * Copyright(c) 2013 Roman Shtylman5 * Copyright(c) 2014-2015 Douglas Christopher Wilson6 * MIT Licensed7 */8perf: enable strict modeDouglas Christopher Wilsonbefore adoptione71014f
lines 9–10why, one step back9'use strict';10docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 11–40why, one step back11/**12 * Module dependencies.13 */1415var parseUrl = require('parseurl');16var qs = require('qs');1718/**19 * @param {Object} options20 * @return {Function}21 * @api public22 */2324module.exports = function query(options) {25 var queryparse = qs.parse;2627 if (typeof options === 'function') {28 queryparse = options;29 options = undefined;30 }3132 return function query(req, res, next){33 if (!req.query) {34 var val = parseUrl(req).query;35 req.query = queryparse(val, options);36 }3738 next();39 };40};