Skip to content

Commit

Permalink
Merge pull request #13 from ATOR-Development/development
Browse files Browse the repository at this point in the history
  • Loading branch information
yumirkov authored Jun 7, 2024
2 parents de53567 + 50efc0b commit 2a3b3ab
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.30",
"@types/supertest": "^6.0.2",
Expand All @@ -24,6 +25,7 @@
"@types/express": "^4.17.21",
"@types/geoip-lite": "^1.4.4",
"axios": "^1.6.8",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.1",
"express-validator": "^7.1.0",
Expand Down
6 changes: 5 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import express from 'express';
import bodyParser from 'body-parser';
import cors from 'cors';
import { body, validationResult } from 'express-validator';
import { VictoriaMetricsService } from './VictoriaMetricsService';
import { OnionooService, HardwareInfo } from './OnionooService';
Expand All @@ -11,6 +12,7 @@ dotenv.config();

const app = express();
app.use(bodyParser.json());
app.use(cors());
const PORT = process.env.PORT ?? 3000;
const vmService = new VictoriaMetricsService(process.env.VICTORIA_METRICS_ADDRESS as string);

Expand Down Expand Up @@ -72,7 +74,9 @@ app.get('/relays/:fingerprint', async (req, res) => {
const relay = {
fingerprint: foundRelay.fingerprint,
running: foundRelay.running,
consensus_weight: foundRelay.consensus_weight
consensus_weight: foundRelay.consensus_weight,
observed_bandwidth: foundRelay.observed_bandwidth,
measured: foundRelay.measured
};
console.log('Relay:', relay);
return res.json(relay);
Expand Down

0 comments on commit 2a3b3ab

Please sign in to comment.