UNPKG

1.39 kBTypeScriptView Raw
1/// <reference types="express" />
2import * as e from 'express';
3import { OptionsV2 as xml2jsOptionsV2 } from 'xml2js';
4import BaseApp, { Plugin, PluginContext } from '../app/BaseApp';
5export declare class RouteRegisterUtil {
6 private routesToRegister;
7 private express;
8 doRegister(): void;
9}
10/**
11 * Client errors do not need to be sent to NewRelic so create clientErrorMiddleware
12 * to send response if the error is 4xx. clientErrorMiddleware needs to be registered
13 * before errorMiddleware.
14 * @param err
15 * @param req
16 * @param res
17 * @param next
18 */
19export declare const clientErrorMiddleware: (err: any, req: any, res: any, next: any) => any;
20export declare const errorMiddleware: (err: any, req: any, res: any, next: any) => any;
21export interface WebPluginOptions {
22 staticRoots?: string[];
23 xmlBodyParserOptions?: xml2jsOptionsV2;
24}
25export default class WebPlugin implements Plugin {
26 private options;
27 static CONTEXT_APP_KEY: string;
28 static CONTEXT_SERVER_KEY: string;
29 name: string;
30 constructor(options?: WebPluginOptions);
31 willStart(app: BaseApp, pluginContext: PluginContext): void;
32 didStart(app: any, pluginContext: any): void;
33 didStop(app: any, pluginContext: any): void;
34 protected registerXmlBodyParser(express: e.Express): void;
35 protected registerXmlContentNegotiationMiddleware(express: e.Express, xmlRoot: string): void;
36}