Skip to content
Snippets Groups Projects
Commit 5b9c3a8c authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Added types

parent b41d82e0
No related branches found
Tags 1.2.0
No related merge requests found
Pipeline #65768 passed
...@@ -8,7 +8,7 @@ Add default metaroutes to express app ...@@ -8,7 +8,7 @@ Add default metaroutes to express app
## Usage ## Usage
`const metaRoutes = require('@libs/metaroutes');` `const metaRoutes = require('@libs/metaroutes');` or `import metaRoutes from './metaRoutes';`
`metaRoutes(app, { version, config, isServiceReady, metricsEndpoint }, routeOptions);` `metaRoutes(app, { version, config, isServiceReady, metricsEndpoint }, routeOptions);`
Where: Where:
......
// Import express types for app and RequestHandler
import { Express, RequestHandler } from 'express';
interface MetaRoutesOptions {
enableVersion?: boolean;
enableConfig?: boolean;
enableHealth?: boolean;
enableReady?: boolean;
enableMetrics?: boolean;
}
interface Config {
_show: () => object; // Adjust according to the actual method signature
}
interface MetaRouteDependencies {
version: string;
config: Config;
isServiceReady: () => boolean;
metricsEndpoint: RequestHandler;
}
// Declaration of the metaRoutes function
declare function metaRoutes(app: Express, dependencies: MetaRouteDependencies, routeOptions?: MetaRoutesOptions): void;
// Export the metaRoutes function to match your JS export
export = metaRoutes;
\ No newline at end of file
{ {
"name": "@libs/metaroutes", "name": "@libs/metaroutes",
"version": "1.1.0", "version": "1.2.0",
"description": "Add default metaroutes to express app", "description": "Add default metaroutes to express app",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment