Skip to content

Commit d1d531f

Browse files
committed
refactor static file serve
1 parent 4cd120d commit d1d531f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ app.use(bodyParser.json());
2020
app.use(bodyParser.urlencoded({ extended: true }));
2121
app.use(cors());
2222

23+
// API Routes
24+
app.use('/api/users', userRouter);
25+
26+
// Serving static files
2327
if (process.env.NODE_ENV === 'production') {
2428
const root = path.join(__dirname, 'client', 'build');
2529

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

32-
// API Routes
33-
app.use('/api/users', userRouter);
34-
3536
const server = app.listen(app.get('port'), () => {
3637
console.log(`Listening on port ${app.get('port')} 🚀`);
3738
console.log(' Press Command C to stop\n');

0 commit comments

Comments
 (0)