mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 23:57:49 +01:00
react-router rouitng
This commit is contained in:
9
app.js
9
app.js
@@ -21,10 +21,6 @@ const passport = require('./config/passport');
|
||||
|
||||
app.use(passport.initialize());
|
||||
|
||||
if (process.env.NODE_ENV === 'prod') {
|
||||
app.use(express.static(path.join(__dirname, 'react/build')));
|
||||
}
|
||||
|
||||
app.use('/api/users', require('./routes/users'));
|
||||
|
||||
const auth = require('./routes/auth');
|
||||
@@ -32,6 +28,11 @@ const auth = require('./routes/auth');
|
||||
app.use('/api/lists', auth.required, require('./routes/lists'));
|
||||
app.use('/api/todos', auth.required, require('./routes/todos'));
|
||||
|
||||
if (process.env.NODE_ENV === 'prod') {
|
||||
app.use(express.static(path.join(__dirname, 'react/build')));
|
||||
app.use('*', express.static(path.join(__dirname, 'react/build/index.html')));
|
||||
}
|
||||
|
||||
// 404 route
|
||||
app.use((req, res) => {
|
||||
res.status(404);
|
||||
|
||||
Reference in New Issue
Block a user