mirror of
https://github.com/whyour/qinglong.git
synced 2026-11-02 06:58:52 +08:00
Package production dependencies per architecture for online and offline upgrades. Validate dependencies and isolated backend startup before readiness, repair once when permitted, and preserve service/data through failed preparation or rollback. Publish release bundles with master images and expose an opt-in develop build sharing the development index across Alpine and Debian images.
34 lines
837 B
TypeScript
34 lines
837 B
TypeScript
import type express from 'express';
|
|
import config from '../config';
|
|
|
|
export async function createHttpApplication(): Promise<express.Application> {
|
|
// Only the HTTP worker needs an Express application and its middleware.
|
|
const [
|
|
{ default: createExpress },
|
|
{ default: helmet },
|
|
{ default: cors },
|
|
{ default: compression },
|
|
{ monitoringMiddleware },
|
|
] = await Promise.all([
|
|
import('express'),
|
|
import('helmet'),
|
|
import('cors'),
|
|
import('compression'),
|
|
import('../middlewares/monitoring'),
|
|
]);
|
|
const app = createExpress();
|
|
app.use((req, res, next) => {
|
|
if (req.query.t) delete req.query.t;
|
|
next();
|
|
});
|
|
app.use(
|
|
helmet({
|
|
contentSecurityPolicy: false,
|
|
}),
|
|
);
|
|
app.use(cors(config.cors));
|
|
app.use(compression());
|
|
app.use(monitoringMiddleware);
|
|
return app;
|
|
}
|