File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -85,16 +85,18 @@ export class Server {
85
85
*/
86
86
private createServer ( ) : HttpServer {
87
87
return createServer ( ( req , res ) => {
88
- this . serveData ( req , res ) ;
89
- this . serveWebsite ( req , res ) ;
88
+ if ( ! this . serveData ( req , res ) ) {
89
+ this . serveWebsite ( req , res ) ; // only serve website if request was not served from serveData
90
+ }
90
91
} ) ;
91
92
}
92
93
93
94
/**
94
95
* Serves the plot data at /data/:id of the container[id].
95
96
* It markes the container as opened and not pending anymore.
96
97
* @param req
97
- * @param res
98
+ * @param res
99
+ * @returns {boolean } - Whether the request was served or not
98
100
*/
99
101
private serveData ( req : IncomingMessage , res : ServerResponse ) {
100
102
if ( req && req . url && req . url . match ( / d a t a \/ [ 0 - 9 ] + / ) ) {
@@ -109,7 +111,9 @@ export class Server {
109
111
110
112
res . end ( JSON . stringify ( temporaryPlots ) ) ;
111
113
this . close ( ) ;
114
+ return true ; // request successfully server
112
115
}
116
+ return false ; // request not served
113
117
}
114
118
115
119
/**
You can’t perform that action at this time.
0 commit comments