File tree Expand file tree Collapse file tree
examples_new/microservices Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ chronos.propagate();
1313
1414const app = express ( ) ;
1515
16- // const trackingMiddleware = chronos.track();
17- // app.use(trackingMiddleware);
16+ const trackingMiddleware = chronos . track ( ) ;
17+ app . use ( trackingMiddleware ) ;
1818
1919app . use (
2020 cors ( {
Original file line number Diff line number Diff line change 1+ const path = require ( 'path' ) ;
2+ require ( 'dotenv' ) . config ( {
3+ path : path . resolve ( __dirname , '../../.env' ) ,
4+ } ) ;
5+
6+ const chronosConfig = {
7+ // General configuration
8+ microservice : 'client' ,
9+ interval : 5000 ,
10+
11+ // Mode Specific
12+ mode : 'microservices' ,
13+ dockerized : false ,
14+
15+ database : {
16+ connection : 'REST' ,
17+ type : process . env . CHRONOS_DB ,
18+ URI : process . env . CHRONOS_URI ,
19+ } ,
20+
21+ notifications : [ ] ,
22+ } ;
23+ module . exports = chronosConfig ;
Original file line number Diff line number Diff line change 11const path = require ( 'path' ) ;
22const express = require ( 'express' ) ;
3- const dotenv = require ( 'dotenv' ) ;
4- dotenv . config ( { path : path . resolve ( __dirname , '/../../.env' ) } ) ;
53
64const PORT = 5000 ;
75
6+ const chronosConfig = require ( './chronos-config' ) ;
7+ const Chronos = require ( '@chronosmicro/tracker' ) ;
8+ const chronos = new Chronos ( chronosConfig ) ;
9+ chronos . propagate ( ) ;
10+
811const app = express ( ) ;
912
13+ const trackingMiddleware = chronos . track ( ) ;
14+ app . use ( trackingMiddleware ) ;
15+
1016app . use ( '/assets' , express . static ( path . resolve ( __dirname , './assets' ) ) ) ;
1117
1218app . use ( '*' , ( req , res ) => {
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ chronos.propagate();
1010
1111const app = express ( ) ;
1212
13- // const trackingMiddleware = chronos.track();
14- // app.use(trackingMiddleware);
13+ const trackingMiddleware = chronos . track ( ) ;
14+ app . use ( trackingMiddleware ) ;
1515
1616app . use ( express . json ( ) ) ;
1717
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ chronos.propagate();
1313
1414const app = express ( ) ;
1515
16- // const trackingMiddleware = chronos.track();
17- // app.use(trackingMiddleware);
16+ const trackingMiddleware = chronos . track ( ) ;
17+ app . use ( trackingMiddleware ) ;
1818
1919app . use (
2020 cors ( {
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ chronos.propagate();
1414
1515const app = express ( ) ;
1616
17- // const trackingMiddleware = chronos.track();
18- // app.use(trackingMiddleware);
17+ const trackingMiddleware = chronos . track ( ) ;
18+ app . use ( trackingMiddleware ) ;
1919
2020app . use (
2121 cors ( {
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ chronos.propagate();
1414
1515const app = express ( ) ;
1616
17- // const trackingMiddleware = chronos.track();
18- // app.use(trackingMiddleware);
17+ const trackingMiddleware = chronos . track ( ) ;
18+ app . use ( trackingMiddleware ) ;
1919
2020app . use (
2121 cors ( {
You can’t perform that action at this time.
0 commit comments