Querystring parsing lab

Medium
37.5% Acceptance

In this lab, we will practice the usage of the querystring module in Node.js, which allows us to perform parsing of query strings in a URL. You'll create and export multiple functions that handle different cases of parsing query strings in the query.js file. All solutions must use the built-in querystring module provided by Node.js.

Understand the following concepts related to query strings and the querystring module:

  • A query string is a part of a URL that contains data in the form of key-value pairs.
  • The querystring module provides utilities for parsing and formatting URL query strings.
  • The querystring.parse() method converts a query string into an object.
  • The querystring.stringify() method converts an object into a query string.

Challenges

  1. Create and export a default function parseQuery that takes a query string and returns an object.
  2. Export a named function decodeURIComponentQuery, which should take a query string and return an object using decodeURIComponent.
  3. Export another named function createQueryString to take an object and return a query string.