React router v4 serve static file (robot.txt)

How can I put my robots.txt file to the path www.domain.com/robots.txt? No server is used, its only frontend with react router.

robots.txt –> in root folder ./

app.js –> in src folder ./src/

(...)

export class App extends React.Component {
 render() {
  return (
   <div>
    <Switch>
      <Route exact path='/stuff' component={Stuff}/>
      <Route exact path='/' component={HomePage}/>
    </Switch>
   </div>
  )
 }
}

If I test it locally, it works OK, localhost:4000/robots.txt opens the file properly in the browser. However I am afraid it is not case in production environment? Any ideas? Thank you in advance

88 thoughts on “React router v4 serve static file (robot.txt)”

  1. 324290 644724Hey! Im at work surfing around your blog from my new apple iphone! Just wanted to say I love reading by way of your blog and look forward to all your posts! Maintain up the outstanding function! 525889

    Reply

Leave a Comment