File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,25 @@ const http = require('http');
66const fs = require ( 'fs' ) ;
77const app = express ( ) ;
88
9- var get_data = ""
9+ let data = "" ;
10+ let numTransactions = 0 ;
11+ const startTime = new Date ( ) ;
1012
11- app . get ( "/check-data" , function ( req , res ) {
12- res . send ( get_data ) ;
13+ // Retrieve number of transactions per minute
14+ app . get ( "/tpm" , function ( req , res ) {
15+ // Calculate duration in minutes
16+ const duration = Math . ceil ( ( new Date ( ) - startTime ) / 60000 ) ;
17+ const tpm = numTransactions / duration ;
18+ res . send ( { tpm } ) ;
19+ } ) ;
20+
21+ app . get ( "/check-data" , function ( req , res ) {
22+ res . send ( data ) ;
1323} ) ;
1424
1525app . all ( '/put-data*' , function ( req , res ) {
16- get_data = "success" ;
26+ data = "success" ;
27+ numTransactions ++ ;
1728 res . send ( '{}' ) ;
1829} ) ;
1930
You can’t perform that action at this time.
0 commit comments