import { NextResponse } from 'next/server'; import Article from '../../models/article'; /** * This route provides an endpoint for a client side fetch request to call * the `findAll()` method on the Article Model. It should be imported into a theme * at `app/api/articles/route.ts` and called inside the exported * GET function. * * The GET function in the theme takes in the request as an argument which should * in turn be passed to this function as an argument. * * To give flexibility in what fields can be requested from each article, fields can be * added or removed from the article serializer in the theme. * * @example * ```tsx * import '../../../api'; * * import routes from '../../../routes'; * * export async function GET(request: Request) { * return routes.articles.index(request); * } * ``` * * The endpoint can then be called at `/api/articles` with any search params * that are required being included as a `params` query paramter. The query parameter * should be a stringified object of all the search params. * * @example * ```tsx * const params = { * page, * pageSize, * }; * * const articlesResponse = await fetch(`/api/articles?params=${JSON.stringify(params)}`); * ``` */ export default function index(request: Request): Promise | NextResponse<{ errors: import("../../../models").ModelError[]; results: never[]; pagination: null; }> | NextResponse<{ results: Article[]; pagination: import("../../models/helpers/pagination").default | null; error: null; }>>; //# sourceMappingURL=articles-index.d.ts.map