mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
added types for express-status-monitor (#38977)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import express = require('express');
|
||||
import expressStatusMonitor = require('express-status-monitor');
|
||||
import socketIO = require('socket.io');
|
||||
|
||||
const app = express();
|
||||
app.use(expressStatusMonitor());
|
||||
app.use(
|
||||
expressStatusMonitor({
|
||||
title: 'Type Test',
|
||||
theme: 'default.css',
|
||||
path: '/status',
|
||||
socketPath: '/socket.io',
|
||||
websocket: null,
|
||||
chartVisibility: {
|
||||
cpu: true,
|
||||
mem: false,
|
||||
load: true,
|
||||
},
|
||||
ignoreStartsWith: '/admin',
|
||||
healthChecks: [],
|
||||
}),
|
||||
);
|
||||
app.use(
|
||||
expressStatusMonitor({
|
||||
spans: [{ interval: 10000, retention: 60 * 1000 }],
|
||||
healthChecks: [
|
||||
{
|
||||
protocol: 'http',
|
||||
host: 'localhost',
|
||||
path: '/healthcheck',
|
||||
port: '4000',
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
const io = socketIO.listen(80);
|
||||
|
||||
app.use(
|
||||
expressStatusMonitor({
|
||||
websocket: io,
|
||||
}),
|
||||
);
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for express-status-monitor 1.2
|
||||
// Project: https://github.com/RafalWilinski/express-status-monitor#readme
|
||||
// Definitions by: Alex Anderson <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="socket.io" />
|
||||
|
||||
import express = require('express');
|
||||
|
||||
declare namespace e {
|
||||
interface ExpressStatusMonitorConfig {
|
||||
title?: string;
|
||||
theme?: string;
|
||||
path?: string;
|
||||
socketPath?: string;
|
||||
websocket?: SocketIO.Server | null; // References a socket.io instance
|
||||
spans?: RetentionSpan[];
|
||||
chartVisibility?: {
|
||||
cpu?: boolean;
|
||||
mem?: boolean;
|
||||
load?: boolean;
|
||||
responseTime?: boolean;
|
||||
rps?: boolean;
|
||||
statusCodes?: boolean;
|
||||
};
|
||||
healthChecks?: HealthCheck[];
|
||||
ignoreStartsWith?: string;
|
||||
}
|
||||
|
||||
interface RetentionSpan {
|
||||
interval: number;
|
||||
retention: number;
|
||||
}
|
||||
interface HealthCheck {
|
||||
protocol: string;
|
||||
host: string;
|
||||
path: string;
|
||||
port: string | number;
|
||||
}
|
||||
}
|
||||
|
||||
declare function e(config?: e.ExpressStatusMonitorConfig): express.RequestHandler;
|
||||
|
||||
export = e;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"express-status-monitor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user