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 {
8585 */
8686 private createServer ( ) : HttpServer {
8787 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+ }
9091 } ) ;
9192 }
9293
9394 /**
9495 * Serves the plot data at /data/:id of the container[id].
9596 * It markes the container as opened and not pending anymore.
9697 * @param req
97- * @param res
98+ * @param res
99+ * @returns {boolean } - Whether the request was served or not
98100 */
99101 private serveData ( req : IncomingMessage , res : ServerResponse ) {
100102 if ( req && req . url && req . url . match ( / d a t a \/ [ 0 - 9 ] + / ) ) {
@@ -109,7 +111,9 @@ export class Server {
109111
110112 res . end ( JSON . stringify ( temporaryPlots ) ) ;
111113 this . close ( ) ;
114+ return true ; // request successfully server
112115 }
116+ return false ; // request not served
113117 }
114118
115119 /**
You can’t perform that action at this time.
0 commit comments