Installation
npm install --save @types/json-server
Summary
This package contains type definitions for json-server (https://github.com/typicode/json-server).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-server.
import { NextHandleFunction } from "connect";
import { Application, RequestHandler, Router } from "express";
import { LowdbSync } from "lowdb";
export interface JsonServerRouter<T> extends Router {
db: LowdbSync<T>;
}
export function create(): Application;
export function defaults(options?: MiddlewaresOptions): RequestHandler[];
export function router<T extends object>(
source: LowdbSync<T> | T | string,
options?: { foreignKeySuffix: string },
): JsonServerRouter<T>;
export function rewriter(rules: { [rule: string]: string }): Router;
export const bodyParser: [NextHandleFunction, NextHandleFunction];
export interface MiddlewaresOptions {
static?: string | undefined;
logger?: boolean | undefined;
bodyParser?: boolean | undefined;
noGzip?: boolean | undefined;
noCors?: boolean | undefined;
readOnly?: boolean | undefined;
}
Additional Details
Credits
These definitions were written by Jeremy Bensimon.