S
S
superivankorolev2017-04-20 15:13:26
JavaScript
superivankorolev, 2017-04-20 15:13:26

How to correctly make a 404 error?

there is react routing

<Route path="/" component={App}>
    <IndexRoute component={HomePage} />
    <Route path="about" component={AboutPage} />
    <Route path="admin" component={AdminPage} />
    <Route path="*" component={notFound} />
    </Route>

and there is express routing
app.get('*', function (req, res) {
  res.sendFile(path.join(__dirname, '/../dist/index.html'))
})

how to make it give a 404 error code? res.status(404).send().
With a direct transition from outside.
And in general, I just started to deal with React. Do search engines index react by default?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question