generated from nholtware/service-template-express
feat: story CRUD API with validation and publishing
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b93d646be0
commit
806e893076
6 changed files with 486 additions and 0 deletions
|
|
@ -14,6 +14,8 @@ import { adminRouter } from "./routes/admin.js";
|
|||
import { healthRouter } from "./routes/health.js";
|
||||
import { logDemoRouter } from "./routes/log-demo.js";
|
||||
import { rootRouter } from "./routes/root.js";
|
||||
import { storiesRouter } from "./routes/stories.js";
|
||||
import { memoryStore, pgStore, type StoryStore } from "./lib/story-store.js";
|
||||
|
||||
export interface Deps {
|
||||
config: Config;
|
||||
|
|
@ -22,6 +24,7 @@ export interface Deps {
|
|||
cache?: Cache;
|
||||
flags?: Flags;
|
||||
runtimeConfig?: RuntimeConfig;
|
||||
store?: StoryStore;
|
||||
}
|
||||
|
||||
export function createApp({
|
||||
|
|
@ -31,6 +34,7 @@ export function createApp({
|
|||
cache,
|
||||
flags,
|
||||
runtimeConfig = staticRuntimeConfig(),
|
||||
store = db ? pgStore(db) : memoryStore(),
|
||||
}: Deps) {
|
||||
const app = express();
|
||||
app.disable("x-powered-by");
|
||||
|
|
@ -59,6 +63,7 @@ export function createApp({
|
|||
|
||||
app.use(healthRouter({ db, cache }));
|
||||
app.use(rootRouter({ config, db, cache, flags, runtimeConfig }));
|
||||
app.use(storiesRouter({ store }));
|
||||
app.use(adminRouter({ runtimeConfig }));
|
||||
app.use(logDemoRouter());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue