11import * as path from 'node:path' ;
22
33import { fastifyStatic } from '@fastify/static' ;
4+ import { fastifyView } from '@fastify/view' ;
5+ import { Liquid } from 'liquidjs' ;
46
57import type { IAuth } from '@app/lib/auth/index.ts' ;
6- import { projectRoot } from '@app/lib/config.ts' ;
8+ import { production , projectRoot } from '@app/lib/config.ts' ;
79import { logger } from '@app/lib/logger.ts' ;
810import * as demo from '@app/routes/demo/index.ts' ;
11+ import * as oauth from '@app/routes/oauth/index.ts' ;
912import * as privateAPI from '@app/routes/private/index.ts' ;
1013import type { App } from '@app/routes/type.ts' ;
1114
@@ -14,8 +17,24 @@ export async function setup(app: App) {
1417
1518 app . decorateRequest ( 'auth' , null ) ;
1619
20+ const liquid = new Liquid ( {
21+ root : path . resolve ( projectRoot , 'templates' ) ,
22+ extname : '.liquid' ,
23+ cache : production ,
24+ } ) ;
25+
26+ await app . register ( fastifyView , {
27+ engine : {
28+ liquid,
29+ } ,
30+ defaultContext : { production } ,
31+ root : path . resolve ( projectRoot , 'templates' ) ,
32+ production,
33+ } ) ;
34+
1735 await app . register ( privateAPI . setup , { prefix : '/p1' } ) ;
1836 await app . register ( demo . setup , { prefix : '/demo/' } ) ;
37+ await app . register ( oauth . setup , { prefix : '/oauth/' } ) ;
1938
2039 await app . register ( fastifyStatic , {
2140 root : path . resolve ( projectRoot , 'static/img/' ) ,
0 commit comments