Skip to content

Commit

Permalink
perf: add compression for SSR (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 authored May 6, 2024
1 parent d09e5ee commit af24bfe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import express from 'express'
import { fileURLToPath } from 'node:url'
import { dirname, join, resolve } from 'node:path'
import bootstrap from './src/main.server'
import compression from 'compression'

// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express()
// Manually added so Lighthouse doesn't complain about adding text compression
server.use(compression())
const serverDistFolder = dirname(fileURLToPath(import.meta.url))
const browserDistFolder = resolve(serverDistFolder, '../browser')
const indexHtml = join(serverDistFolder, 'index.server.html')
Expand Down

0 comments on commit af24bfe

Please sign in to comment.