New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

restful-qs

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restful-qs

Parse querystrings into queries for your RESTful services.

latest
Source
npmnpm
Version
0.6.4
Version published
Weekly downloads
14
-41.67%
Maintainers
1
Weekly downloads
 
Created
Source

RESTful Query String Parser Build Status npm version

Parse querystrings into queries for your RESTful services.

Install

$ npm i restful-qs

Usage

String parsing:

'use strict';
var parseRESTfulQuery = require('./');

var qs = 'age=29&name=Sabrina&link=friends&embed=hobbies,adventures';
var parsed = parseRESTfulQuery(qs);

console.log(JSON.stringify(parsed, null, 2));

Inside a web server:

'use strict';
var url = require('url');
var http = require('http');

var parseRESTfulQuery = require('../');

http.createServer(function (request, response) {
  var query = url.parse(request.url).query || 'sort=foo';
  var restfulQuery = parseRESTfulQuery(query);
  var out = JSON.stringify(restfulQuery, null, 2);

  response.writeHead(200, {
    'Content-Type': 'application/json',
    'Content-Length': Buffer.byteLength(out),
  });
  response.end(out);
})
.listen(3000);

console.log('listening at http://localhost:3000/');

API

parseRESTfulQuery(qs)

Parses a string or object into a RESTful query.

Keywords

restful

FAQs

Package last updated on 14 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts