File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { z } from 'zod'
1111import { Data , Service } from './service.js'
1212
1313const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
14+ const isProduction = process . env [ 'NODE_ENV' ] === 'production'
1415
1516export type AppOptions = {
1617 logger ?: boolean
@@ -19,7 +20,7 @@ export type AppOptions = {
1920
2021const eta = new Eta ( {
2122 views : join ( __dirname , '../views' ) ,
22- cache : true
23+ cache : isProduction
2324} )
2425
2526function dataHandler ( req , res , next ) {
@@ -47,7 +48,7 @@ export function createApp(db: Low<Data>, options: AppOptions = {}) {
4748 options
4849 . static
4950 ?. map ( ( path ) => isAbsolute ( path ) ? path : join ( process . cwd ( ) , path ) )
50- . forEach ( ( dir ) => app . use ( sirv ( dir ) ) )
51+ . forEach ( ( dir ) => app . use ( sirv ( dir , { dev : ! isProduction } ) ) )
5152
5253 app . get ( '/' , ( _req , res ) => res . send ( eta . render ( 'index.html' , { data : db . data } ) ) )
5354
You can’t perform that action at this time.
0 commit comments