@@ -9,6 +9,7 @@ var lastUserAgent = '';
9
9
var chunked = false ;
10
10
var delay = 0 ;
11
11
var permanentError = 0 ;
12
+ const prefix = '' ;
12
13
13
14
app . use ( function ( req , res , next ) {
14
15
var data = '' ;
@@ -22,32 +23,32 @@ app.use (function(req, res, next) {
22
23
next ( ) ;
23
24
} ) ;
24
25
} ) ;
25
- app . get ( '/test/user-agent' , ( req , res ) => {
26
+ app . get ( prefix + '/test/user-agent' , ( req , res ) => {
26
27
res . status ( 200 ) . send ( lastUserAgent ) ;
27
28
} )
28
- app . get ( '/ready' , ( req , res ) => {
29
+ app . get ( prefix + '/ready' , ( req , res ) => {
29
30
lastUserAgent = req . get ( 'User-Agent' ) ;
30
31
res . status ( 200 ) . send ( "<html><body><h1>OK</h1></body></html>" ) ;
31
32
} )
32
- app . get ( '/health' , ( req , res ) => {
33
+ app . get ( prefix + '/health' , ( req , res ) => {
33
34
lastUserAgent = req . get ( 'User-Agent' ) ;
34
35
res . status ( 200 ) . send ( "<html><body><h1>OK</h1></body></html>" ) ;
35
36
} )
36
37
37
- app . get ( '/ping' , ( req , res ) => {
38
+ app . get ( prefix + '/ping' , ( req , res ) => {
38
39
lastUserAgent = req . get ( 'User-Agent' ) ;
39
40
if ( req . query [ 'verbose' ] == 'true' ) {
40
41
res . status ( 200 ) . send ( "<html><body><h1>OK</h1></body></html>" ) ;
41
42
} else {
42
43
res . status ( 204 ) . end ( ) ;
43
44
}
44
45
} )
45
- app . post ( '/log' , ( req , res ) => {
46
+ app . post ( prefix + '/log' , ( req , res ) => {
46
47
console . log ( req . body ) ;
47
48
res . status ( 204 ) . end ( ) ;
48
49
} )
49
50
50
- app . post ( '/api/v2/write' , ( req , res ) => {
51
+ app . post ( prefix + '/api/v2/write' , ( req , res ) => {
51
52
chunked = false ;
52
53
if ( checkWriteParams ( req , res ) && handleAuthentication ( req , res ) ) {
53
54
//console.log('Write');
@@ -132,7 +133,7 @@ app.post('/api/v2/write', (req,res) => {
132
133
}
133
134
} )
134
135
135
- app . post ( '/write' , ( req , res ) => {
136
+ app . post ( prefix + '/write' , ( req , res ) => {
136
137
if ( checkWriteParamsV1 ( req , res ) ) {
137
138
var points = parsePoints ( req . body ) ;
138
139
if ( Array . isArray ( points ) && points . length > 0 ) {
@@ -170,7 +171,7 @@ app.post('/write', (req,res) => {
170
171
}
171
172
} )
172
173
173
- app . post ( '/api/v2/delete' , ( req , res ) => {
174
+ app . post ( prefix + '/api/v2/delete' , ( req , res ) => {
174
175
console . log ( 'Deleteting points' ) ;
175
176
pointsdb = [ ] ;
176
177
res . status ( 204 ) . end ( ) ;
@@ -259,7 +260,7 @@ function sleep(milliseconds) {
259
260
} while ( currentDate - date < milliseconds ) ;
260
261
}
261
262
262
- app . post ( '/api/v2/query' , ( req , res ) => {
263
+ app . post ( prefix + '/api/v2/query' , ( req , res ) => {
263
264
//console.log("Query with: " + req.body);
264
265
if ( checkQueryParams ( req , res ) && handleAuthentication ( req , res ) ) {
265
266
var queryObj = JSON . parse ( req . body ) ;
0 commit comments