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'
11
11
import { Data , Service } from './service.js'
12
12
13
13
const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
14
+ const isProduction = process . env [ 'NODE_ENV' ] === 'production'
14
15
15
16
export type AppOptions = {
16
17
logger ?: boolean
@@ -19,7 +20,7 @@ export type AppOptions = {
19
20
20
21
const eta = new Eta ( {
21
22
views : join ( __dirname , '../views' ) ,
22
- cache : true
23
+ cache : isProduction
23
24
} )
24
25
25
26
function dataHandler ( req , res , next ) {
@@ -47,7 +48,7 @@ export function createApp(db: Low<Data>, options: AppOptions = {}) {
47
48
options
48
49
. static
49
50
?. 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 } ) ) )
51
52
52
53
app . get ( '/' , ( _req , res ) => res . send ( eta . render ( 'index.html' , { data : db . data } ) ) )
53
54
You can’t perform that action at this time.
0 commit comments