generated from nholtware/service-template-express
feat: Unleash feature flags via src/lib/flags.ts, hello-banner on GET /
Ported from service-template-express 9b63993.
This commit is contained in:
parent
28ec495a98
commit
ec4b769be2
12 changed files with 675 additions and 17 deletions
|
|
@ -4,6 +4,7 @@ import { pinoHttp } from "pino-http";
|
|||
import type { Logger } from "pino";
|
||||
import type { Config } from "./lib/config.js";
|
||||
import type { Db } from "./lib/db.js";
|
||||
import type { Flags } from "./lib/flags.js";
|
||||
import type { Cache } from "./lib/redis.js";
|
||||
import { healthRouter } from "./routes/health.js";
|
||||
import { logDemoRouter } from "./routes/log-demo.js";
|
||||
|
|
@ -14,9 +15,10 @@ export interface Deps {
|
|||
logger: Logger;
|
||||
db?: Db;
|
||||
cache?: Cache;
|
||||
flags?: Flags;
|
||||
}
|
||||
|
||||
export function createApp({ config, logger, db, cache }: Deps) {
|
||||
export function createApp({ config, logger, db, cache, flags }: Deps) {
|
||||
const app = express();
|
||||
app.disable("x-powered-by");
|
||||
|
||||
|
|
@ -43,7 +45,7 @@ export function createApp({ config, logger, db, cache }: Deps) {
|
|||
);
|
||||
|
||||
app.use(healthRouter({ db, cache }));
|
||||
app.use(rootRouter({ config, db, cache }));
|
||||
app.use(rootRouter({ config, db, cache, flags }));
|
||||
app.use(logDemoRouter());
|
||||
|
||||
// Express identifies error handlers by arity; keep all four args.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue