[feathersjs__express] clarified definitions and tests

This commit is contained in:
Aleksey Klimenko
2018-03-24 04:29:35 +03:00
parent 6490e73891
commit 329bf5da38
2 changed files with 19 additions and 9 deletions

View File

@@ -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 }));

View File

@@ -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.