File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
arduino-ide-extension/src/node/plotter Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change 1+ import * as path from 'path' ;
12import * as express from 'express' ;
23import { injectable } from '@theia/core/shared/inversify' ;
34import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application' ;
4- import path = require( 'path' ) ;
55
66@injectable ( )
77export class PlotterBackendContribution
88 implements BackendApplicationContribution
99{
10- async initialize ( ) : Promise < void > { }
11-
1210 configure ( app : express . Application ) : void {
13- const relativePath = [
14- '..' ,
15- '..' ,
16- '..' ,
17- '..' ,
18- 'node_modules' ,
19- 'arduino-serial-plotter-webapp' ,
20- 'build' ,
21- ] ;
22- app . use ( express . static ( path . join ( __dirname , ...relativePath ) ) ) ;
11+ const index = require . resolve (
12+ 'arduino-serial-plotter-webapp/build/index.html'
13+ ) ;
14+ app . use ( express . static ( path . join ( index , '..' ) ) ) ;
2315 app . get ( '/plotter' , ( req , res ) => {
2416 console . log (
2517 `Serving serial plotter on http://${ req . headers . host } ${ req . url } `
2618 ) ;
27- res . sendFile ( path . join ( __dirname , ... relativePath , ' index.html' ) ) ;
19+ res . sendFile ( index ) ;
2820 } ) ;
2921 }
3022}
You can’t perform that action at this time.
0 commit comments