mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-01-24 13:45:07 +08:00
fix(express): redirect 404s to index.html
This commit is contained in:
parent
6fe4c70aa2
commit
218a59e9ce
@ -36,5 +36,14 @@ const server = new ApolloServer({ typeDefs, resolvers, context });
|
||||
const app = express();
|
||||
|
||||
server.applyMiddleware({ app });
|
||||
|
||||
// Serve Webpack shell files from './shell/dist'
|
||||
app.use(express.static('shell/dist'));
|
||||
|
||||
// Redirect all 404 to index.html with status 200
|
||||
// This should always be the last route
|
||||
app.use((req, res) => {
|
||||
res.sendFile(path.resolve(process.cwd(), 'shell/dist/index.html'));
|
||||
});
|
||||
|
||||
app.listen({ port: 3000 }, () => console.log(`🚀 Server ready at http://localhost:3000`));
|
||||
|
Loading…
Reference in New Issue
Block a user