mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-21 08:33:26 +08:00
[feathersjs__express] clarified definitions and tests
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import feathers, { Application } from '@feathersjs/feathers';
|
||||
import feathersExpress, { original, rest, notFound, errorHandler } from '@feathersjs/express';
|
||||
import feathersExpress, * as express from "@feathersjs/express";
|
||||
|
||||
const app = feathersExpress(feathers());
|
||||
|
||||
app.configure(rest());
|
||||
app.use(notFound());
|
||||
app.use(errorHandler());
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
app.use('/', express.static('./public'));
|
||||
app.configure(express.rest());
|
||||
app.use(express.notFound());
|
||||
app.use(express.errorHandler({ logger: console }));
|
||||
|
||||
17
types/feathersjs__express/index.d.ts
vendored
17
types/feathersjs__express/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for @feathersjs/express 1.1
|
||||
// Project: http://feathersjs.com/
|
||||
// Definitions by: Jan Lohage <https://github.com/j2L4e>
|
||||
// Aleksey Klimenko <https://github.com/DadUndead>
|
||||
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -10,12 +11,18 @@ import * as express from 'express';
|
||||
export default function feathersExpress<T>(app: FeathersApplication<T>): Application<T>;
|
||||
export type Application<T> = express.Application & FeathersApplication<T>;
|
||||
|
||||
export function errorHandler(options?: any): express.ErrorRequestHandler;
|
||||
export function errorHandler(options?: {
|
||||
public?: string,
|
||||
logger?: { error?: (msg: string) => void },
|
||||
html?: any,
|
||||
json?: any,
|
||||
}): express.ErrorRequestHandler;
|
||||
export function notFound(): express.RequestHandler;
|
||||
export const rest: {
|
||||
(): () => void;
|
||||
formatter: express.RequestHandler;
|
||||
};
|
||||
|
||||
export function rest(): (handler?: express.RequestHandler) => void;
|
||||
export namespace rest {
|
||||
export let formatter: express.RequestHandler;
|
||||
}
|
||||
|
||||
/*
|
||||
* Re-export of the express package.
|
||||
|
||||
Reference in New Issue
Block a user