Skip to content

Query String

Easy — everyone uses thisNetworking

ELI5 — The Vibe Check

A query string is the part of a URL after the question mark. It's how you pass extra information to a web server — like search terms, page numbers, or filters. 'google.com/search?q=cats' — everything after '?' is the query string: q=cats.

Real Talk

A query string is the portion of a URL beginning with '?' containing key-value pairs separated by '&'. It passes parameters to the server without affecting the resource path. Query strings are visible in the URL, logged by servers, and can be bookmarked.

Show Me The Code

// Parsing query strings
// URL: /products?category=shoes&size=10&color=red

// Express.js
app.get('/products', (req, res) => {
  const { category, size, color } = req.query;
  // category = 'shoes', size = '10', color = 'red'
});

// Vanilla JS
const params = new URLSearchParams(window.location.search);
const category = params.get('category'); // 'shoes'

When You'll Hear This

"Pass the search term as a query string parameter." / "Don't put sensitive data in the query string — it appears in logs."

Made with passive-aggressive love by manoga.digital. Powered by Claude.