Skip to content

Commit

Permalink
fix: make app production ready
Browse files Browse the repository at this point in the history
  • Loading branch information
jovinjijo committed Oct 26, 2020
1 parent 432e452 commit 249ca9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"start": "lerna run start --parallel",
"build-watch": "yarn run build && yarn run tscw",
"test": "lerna run test --parallel",
"prod:build": "yarn run build && lerna run prod:build --stream",
"prod:start": "cross-env NODE_ENV=production lerna run start --scope=@se/api",
"release": "cross-env HUSKY_BYPASS=true lerna publish"
},
"husky": {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ app.use(session);
// If a user is logged in, fill up req.user with user details
app.use(fillUserData);

app.use('/v1/', routes);

const isProd = process.env.NODE_ENV === 'production';
if (isProd) {
// Compute the build path and index.html path
Expand All @@ -42,8 +44,6 @@ if (isProd) {
app.get('*', (req, res) => res.sendFile(indexHtml));
}

app.use('/v1/', routes);

/**
* Error Handler to respond in JSON
*/
Expand Down

0 comments on commit 249ca9a

Please sign in to comment.