Skip to content

Commit

Permalink
Serve static content in production
Browse files Browse the repository at this point in the history
  • Loading branch information
gareththegeek committed Dec 23, 2020
1 parent 225a118 commit 6deaf2b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions api/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ app.use(cors())

app.use(securityHeaders)

if (process.env.NODE_ENV !== 'production') {
app.use(
express.static(
path.join(__dirname, 'public/ui/build' /* because copypaths */)
)
)
}
const publicPath =
process.env.NODE_ENV === 'production'
? 'public'
: 'public/ui/build' /* because copypaths */
app.use(express.static(path.join(__dirname, publicPath)))

routes(app)

Expand Down

0 comments on commit 6deaf2b

Please sign in to comment.