I would like to serve static files with extension, but the following doesn’t seem to work:
import { injectable } from 'inversify';
import { BackendApplicationContribution } from '@theia/core/lib/node';
import * as express from 'express';
import path = require('path');
@injectable()
export class TheiaStaticWebBackendApplicationContribution implements BackendApplicationContribution {
configure(app: express.Application): void {
const staticPath = path.join(__dirname, '..', '..', 'static');
app.use('/my-extension/static', express.static(staticPath));
}
}
I tried adding app.get('/test-response')
, and that seems to work fine. Is there a reason app.use()
doesn’t work?
PS: the grammar checker on this forum is a bit too strict. It would not allow “BackendApplicationContribution” in the title?