Skip to content

Commit

Permalink
refactor static file serve
Browse files Browse the repository at this point in the history
  • Loading branch information
Orang-utan committed Aug 14, 2020
1 parent 4cd120d commit d1d531f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors());

// API Routes
app.use('/api/users', userRouter);

// Serving static files
if (process.env.NODE_ENV === 'production') {
const root = path.join(__dirname, 'client', 'build');

Expand All @@ -29,9 +33,6 @@ if (process.env.NODE_ENV === 'production') {
});
}

// API Routes
app.use('/api/users', userRouter);

const server = app.listen(app.get('port'), () => {
console.log(`Listening on port ${app.get('port')} 🚀`);
console.log(' Press Command C to stop\n');
Expand Down

0 comments on commit d1d531f

Please sign in to comment.