Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/titobrian97/Prueba-tecnica-ts-node---gestion-de-csv/llms.txt

Use this file to discover all available pages before exploring further.

This endpoint searches the in-memory usersData array — populated by a prior POST /api/files upload — and returns every row that contains the search term as a substring in any of its column values. Matching is case-insensitive, so it doesn’t matter how the query is capitalised. If no rows match, the endpoint still returns HTTP 200 with an empty data array.

Endpoint

GET /api/users?q={query}

Query Parameters

q
string
required
The search term to match against. The server performs a case-insensitive substring comparison across all column values in every stored row. A row is included in the response if at least one column value contains the query string.

Example Requests

# Search for rows containing 'carlos'
curl "http://localhost:3000/api/users?q=carlos"

# Search by city
curl "http://localhost:3000/api/users?q=mexico"

# Search by email domain
curl "http://localhost:3000/api/users?q=example.com"

Success Response — HTTP 200

The server always returns HTTP 200 when the q parameter is present, regardless of whether any rows matched.
data
array
required
Array of row objects whose column values match the search query. Each object has the same shape as the rows returned by POST /api/files — keys are the CSV column headers and all values are strings. Returns an empty array [] when no rows match the query.

Example Response for ?q=carlos

{
  "data": [
    {
      "id": "1",
      "nombre": "Carlos",
      "apellido": "Mendez",
      "edad": "34",
      "email": "carlos.mendez@example.com",
      "ciudad": "Cancun",
      "pais": "Mexico",
      "telefono": "+52-998-123-4567"
    }
  ]
}

Filtering Logic

The filter is applied using the following expression taken directly from server.ts:
Object.values(row).some((value) =>
  value.toLowerCase().includes(search)
)
Object.values(row) collects every column value for a given row, and .some(...) returns true as soon as any single value passes the test. The test lowercases both the stored value and the incoming query before calling .includes(), which means:
  • The match is case-insensitive"Carlos", "carlos", and "CARLOS" are all equivalent.
  • The match is a substring — querying "car" would match "Carlos" as well as any other value containing those three characters.
  • The match spans all columns — a query of "mexico" can match on the pais column, the ciudad column, a phone prefix, or any other column that happens to contain that string.

Error Response — HTTP 500

Returned when the request is made without providing the q query parameter.
{
  "message": "No hay parametro de busqueda"
}
If no CSV file has been uploaded yet — or if the server was restarted since the last upload — usersData is an empty array. Every search query will return {"data": []} until a file is successfully uploaded via POST /api/files.
The search is fully case-insensitive. Querying "Mexico", "mexico", or "MEXICO" will all return exactly the same set of matching rows, because both the stored values and your query are lowercased before comparison.

Build docs developers (and LLMs) love