Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ if ( process.env.MODE !== 'development'){

app.use("/api/mongodb", mongodb);

// catch-all route to /page-not-found/index.html defined last to handle page not found error
app.get('/*', (req, res) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add comments before this line about what this function to do

res.sendFile(__dirname + '/build/page-not-found/index.html');
})

app.on('error', function (e) {
// do your thing
console.log(e);
Expand Down
6 changes: 4 additions & 2 deletions src/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import DeploymentPage from 'pages/DeploymentPage';
import PushactionPage from 'pages/PushactionPage';
import PrivacyPolicyPage from 'pages/PrivacyPolicyPage';
import TermsOfUsePage from 'pages/TermsOfUsePage';
import NotFound404Page from 'pages/NotFound404Page';

import { WillRoute } from 'hocs';
import { connectStart } from 'reducers/endpoint';
Expand Down Expand Up @@ -49,7 +50,7 @@ class App extends Component {
render() {
return (
<div className="App">
<Switch>
<Switch>
<WillRoute exact path="/" component={ InfoPage }/>
<WillRoute exact path="/block-list" component={ BlocklistPage }/>
<WillRoute exact path="/block/:id" component={ BlockdetailPage }/>
Expand All @@ -66,7 +67,8 @@ class App extends Component {
<WillRoute exact path="/push-action" component={ PushactionPage }/>
<WillRoute exact path="/privacy-policy" component={ PrivacyPolicyPage }/>
<WillRoute exact path="/terms-of-use" component={ TermsOfUsePage }/>

<WillRoute exact path="/page-not-found" component={ NotFound404Page }/>

<Redirect to="/" />
</Switch>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ const Header = (props) => {
</NavItem>
</Nav>
</NavWrapperRow>
<div style={{display:"none"}}>
<Link to={`/page-not-found`} ></Link>
</div>
</div>
)
}
Expand Down
15 changes: 15 additions & 0 deletions src/pages/NotFound404Page/NotFound404Page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, { Component } from 'react';
import { StandardTemplate } from 'templates';


class NotFound404Page extends Component {
render() {
return (
<StandardTemplate>
<div style={{height: '100vh'}}></div>
</StandardTemplate>
);
}
}

export default NotFound404Page;
6 changes: 6 additions & 0 deletions src/pages/NotFound404Page/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Loadable from 'react-loadable';

export default Loadable({
loader: () => import('./NotFound404Page'),
loading: () => false
});