export Response thanks to a namespace

This commit is contained in:
Tanguy Krotoff
2015-12-19 03:26:50 +01:00
parent e16ce4a79a
commit b42e2a25b6
2 changed files with 18 additions and 0 deletions

View File

@@ -9,3 +9,5 @@ api.get('/users/:userid', function (req, res, next) {
});
api.use(errorHandler());
let res: errorHandler.Response;

View File

@@ -8,6 +8,22 @@
declare module 'api-error-handler' {
import * as express from 'express';
namespace apiErrorHandler {
// Body response: the JSON returned by api-error-handler
// See https://github.com/expressjs/api-error-handler/blob/1.0.0/index.js
interface Response {
status: number;
stack?: string;
message: string;
// Client errors
code?: any;
name?: string;
type?: any;
}
}
function apiErrorHandler(options?: any): express.ErrorRequestHandler;
export = apiErrorHandler;