Skip to content
Drivers/Spring Data REST

Spring Data REST

driverspring1/8 capabilities

Import the driver directly so every other driver tree-shakes away.

spring.ts
import { SPRING_DRIVER, QubeeStore, QueryBuilder, Paginator } from '@qubeejs/core';
const store = new QubeeStore();
const qb = new QueryBuilder(store, SPRING_DRIVER.createRequestStrategy('query'));
const paginator = new Paginator(
store,
SPRING_DRIVER.createResponseStrategy(),
SPRING_DRIVER.createResponseOptions({}),
);
qb.setResource('articles')
.addSort('createdAt', SortEnum.DESC)
.setLimit(25)
.generateUri();

Produces:

/articles?sort=createdAt,desc&page=0&size=25
Capability Supported
Filters —
Operators —
Sort ✅
Select —
Fields —
Includes —
Search —
Embedded —
const body = await fetch(`https://example.com/api${uri}`).then((r) => r.json());
const page = paginator.paginate(body);
page.data; // rows
page.total; // total rows the backend reported
page.lastPage; // final page number