JSPM

express-qs-manager

0.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q30041F
  • License MIT

A query string manager for express

Package Exports

  • express-qs-manager

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-qs-manager) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

express-qs-manager

A query string manager for express

What does it do

It allows you to easily manipulate query strings within templates

Usage

check the examples folder for usage scenarios

Initialize like so :

var Qs = require('express-qs-manager');
app.use(Qs.init());

then somewhere in your routes assign to a variable the query string from express and pass it to the templates

res.render('myTemplate.html',{QueryString : req.query});

After that you're good to go. In any template just use the Qs.appends or Qs.exclude methods to either add or remove parameters from the query string. You can also use the Qs.has method to check if a key-value set is in the query string

<a href="?{{ Qs.appends(QueryString,{myKey:'myValue'}) }}"
                       class="{% if Qs.has(QueryString,'myKey','myValue') %} active{%endif%}">
                        A link</a>