mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-19 23:29:28 +00:00
Serial Plotter implementation (#597)
* spawn new window where to instantiate serial plotter app * initialize serial monito web app * connect serial plotter app with websocket * use npm serial-plotter package * refactor monitor connection and fix some connection issues * fix clearConsole + refactor monitor connection * add serial unit tests * refactoring and cleaning code
This commit is contained in:
committed by
GitHub
parent
9863dc2f90
commit
20f7712129
@@ -0,0 +1,29 @@
|
||||
import * as express from 'express';
|
||||
import { injectable } from 'inversify';
|
||||
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
|
||||
import path = require('path');
|
||||
|
||||
@injectable()
|
||||
export class PlotterBackendContribution
|
||||
implements BackendApplicationContribution
|
||||
{
|
||||
async initialize(): Promise<void> {}
|
||||
|
||||
configure(app: express.Application): void {
|
||||
const relativePath = [
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'build',
|
||||
'arduino-serial-plotter-webapp',
|
||||
'build',
|
||||
];
|
||||
app.use(express.static(path.join(__dirname, ...relativePath)));
|
||||
app.get('/plotter', (req, res) => {
|
||||
console.log(
|
||||
`Serving serial plotter on http://${req.headers.host}${req.url}`
|
||||
);
|
||||
res.sendFile(path.join(__dirname, ...relativePath, 'index.html'));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user