Skip to content

Commit 2e20025

Browse files
committed
Add root route
1 parent 9ee4ba8 commit 2e20025

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

codegen/lib/connect.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export const connect = (
1717
const metadata = metalsmith.metadata() as Metadata
1818
const { blueprint } = metadata
1919

20+
const rootRouteKey = `${rootPath}/seam-http.js`
21+
files[rootRouteKey] = { contents: Buffer.from('\n') }
22+
const rootRouteFile = files[rootRouteKey] as unknown as File
23+
rootRouteFile.layout = 'route.hbs'
24+
setRootRouteLayoutContext(rootRouteFile, blueprint)
25+
2026
for (const route of Object.values(blueprint.routes ?? {})) {
2127
const k = `${rootPath}/${route.path
2228
.slice(1)
@@ -38,6 +44,16 @@ interface RouteLayoutContext {
3844
needsActionAttempts: boolean
3945
}
4046

47+
const setRootRouteLayoutContext = (
48+
file: Partial<RouteLayoutContext>,
49+
_blueprint: Blueprint,
50+
): void => {
51+
file.className = 'SeamHttp'
52+
file.needsActionAttempts = false
53+
file.isClientSessionRoute = false
54+
file.isActionAttemptsRoute = false
55+
}
56+
4157
const setRouteLayoutContext = (
4258
file: Partial<RouteLayoutContext>,
4359
route: Route,

0 commit comments

Comments
 (0)