mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 20:09:15 +08:00
Merge pull request #24497 from DadUndead/master
fix(@feathersjs/express): added missing 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 }));
|
||||
|
||||
11
types/feathersjs__express/index.d.ts
vendored
11
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,10 +11,16 @@ 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;
|
||||
(handler?: express.RequestHandler): () => void;
|
||||
formatter: express.RequestHandler;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user