@varasto/express-crud
Version:
Express.js CRUD generator that uses Varasto storage
17 lines (16 loc) • 866 B
TypeScript
import { Storage } from '@varasto/storage';
import { Router } from 'express';
import { JsonObject } from 'type-fest';
import { RouterOptions } from './types';
/**
* Constructs an router that provides CRUD operations for an namespace in given
* storage. All data passed through `POST` or `PATCH` operations must pass
* validation provided by given schema.
*
* @param storage Varasto storage to used for storing the data.
* @param namespace Namespace where the data will be stored into.
* @param options Various options that can be given to the router.
* @returns An Express.js router that provides CRUD operations which work on
* data stored in specified namespace in the Varasto storage.
*/
export declare const createRouter: <T extends JsonObject = JsonObject>(storage: Storage, namespace: string, options?: Partial<RouterOptions<T>>) => Router;