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 functionsqs- 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 toNOT_EQUALS- Not equal toGREATER_THAN- Greater thanLOWER_THAN- Less thanGREATER_THAN_EQUALS- Greater than or equalLOWER_THAN_EQUALS- Less than or equalSTARTS- Starts withENDS- Ends withCONTAINS- ContainsEXCLUDES- ExcludesIN- In arrayNOT_IN- Not in arrayIS_NULL- Is nullNOT_NULL- Is not nullBETWEEN- 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 yourtsconfig.json includes: