Skip to main content

Installation

The request package can be installed independently or as part of the full CRUD framework:
If you install @nestjsx/crud, this package is automatically included as a dependency. You only need to install it separately if you want to use the query builder in a standalone project.

Automatic Dependencies

The following packages are automatically installed:
  • @nestjsx/util - Shared utility functions
  • qs - Query string parsing and stringification

Usage in Frontend Applications

This package is particularly useful in frontend applications for building API queries:

Basic Setup

Building Simple Queries

Building Complex Queries

Common Query Patterns

Pagination

Sorting

Filtering

Relations

Field Selection

Usage in Backend Applications

Automatic Parsing

When using @nestjsx/crud, request parsing happens automatically:

Manual Parsing

You can also parse queries manually:

Integration with HTTP Clients

Axios

Fetch API

Angular HttpClient

TypeScript Support

The package includes full TypeScript definitions:

Available Operators

The package provides the following filter operators:
  • EQUALS - Equal to
  • NOT_EQUALS - Not equal to
  • GREATER_THAN - Greater than
  • LOWER_THAN - Less than
  • GREATER_THAN_EQUALS - Greater than or equal
  • LOWER_THAN_EQUALS - Less than or equal
  • STARTS - Starts with
  • ENDS - Ends with
  • CONTAINS - Contains
  • EXCLUDES - Excludes
  • IN - In array
  • NOT_IN - Not in array
  • IS_NULL - Is null
  • NOT_NULL - Is not null
  • BETWEEN - Between values

Next Steps

Core Package

Learn about the core CRUD package

TypeORM Integration

Add TypeORM for database operations

Troubleshooting

Query String Too Long

If your query strings are getting too long, consider:
  • Using POST requests for complex filters
  • Implementing server-side saved filters
  • Breaking down complex queries into multiple requests

TypeScript Errors

Ensure your tsconfig.json includes: