-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3500a3d
commit 4d9bfaf
Showing
2 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (C) 2022 Edge Network Technologies Limited | ||
// Use of this source code is governed by a GNU GPL-style license | ||
// that can be found in the LICENSE.md file. All rights reserved. | ||
|
||
// import * as metrics from './metrics' | ||
// import cors from 'cors' | ||
import express, { ErrorRequestHandler, RequestHandler } from 'express' | ||
|
||
export class API { | ||
private app: express.Express | ||
private network: any | ||
|
||
constructor(network: any) { | ||
this.app = express() | ||
this.network = network | ||
} | ||
|
||
async initialize (): Promise<void> { | ||
const app = this.app | ||
// app.use(cors()) | ||
app.use(express.json()) | ||
|
||
app.get('/metrics', async (req, res) => { | ||
res.send(await this.network.metricsRegistry.registry.metrics()) | ||
}) | ||
|
||
app.listen('5000') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters