File tree 1 file changed +6
-14
lines changed
arduino-ide-extension/src/node/plotter 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change
1
+ import * as path from 'path' ;
1
2
import * as express from 'express' ;
2
3
import { injectable } from '@theia/core/shared/inversify' ;
3
4
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application' ;
4
- import path = require( 'path' ) ;
5
5
6
6
@injectable ( )
7
7
export class PlotterBackendContribution
8
8
implements BackendApplicationContribution
9
9
{
10
- async initialize ( ) : Promise < void > { }
11
-
12
10
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 , '..' ) ) ) ;
23
15
app . get ( '/plotter' , ( req , res ) => {
24
16
console . log (
25
17
`Serving serial plotter on http://${ req . headers . host } ${ req . url } `
26
18
) ;
27
- res . sendFile ( path . join ( __dirname , ... relativePath , ' index.html' ) ) ;
19
+ res . sendFile ( index ) ;
28
20
} ) ;
29
21
}
30
22
}
You can’t perform that action at this time.
0 commit comments