title: How to get data from React aplication on Express server to update meta-tags with data fetched from API
body: <p>I am using a React API where I fetch data using an API call. I need this data to be accessible in Express server so that I can update meta-tags, but I haven't found the way to achive this. This is the URL estructure:</p>
  <pre><code>/post/slug
  </code></pre>
  <p>React component where I fetch all the data:</p>
  <pre><code>const Post = () =&gt; {
  
      const [post, setPost] = useState(null)
      const { slug } = useParams();
  
      useEffect(() =&gt; {
          const urlFetch = 'URL' + slug;
  
          fetch(urlFetch )
          .then(response =&gt; response.json())
          .then(data =&gt; setPost(data));
      }, [slug]);
  
      if (!post) {
          return (
              &lt;&gt;
                  //Loader
              &lt;/&gt;
          )
      }
  
      return (
          &lt;&gt;
              //component
          &lt;/&gt;
      );
  
  }
  
  export default Post;
  </code></pre>
  <p>In order to change meta-tags dynamically y use Express but I have no idea how can I achieve this., this is server.js file:</p>
  <pre><code>const express = require('express');
  const path = require('path');
  const fs = require('fs');
  const util = require('util');
  
  const PORT = 5000;
  
  const app = express();
  
  app.get(&quot;/&quot;, async (req, res) =&gt; {
      const filePath = path.resolve(__dirname, &quot;./client/build&quot;, &quot;index.html&quot;);
      await fs.readFile(filePath, &quot;utf8&quot;, (err, data) =&gt; {
          if (err) {
              return console.log(err);
          }
  
          data = data
              .replace(/__TITLE__/g, &quot;Home title&quot;)
              .replace(/__DESCRIPTION__/g, &quot;Home description&quot;);
      
          res.send(data);
      })
  })
  
  app.get('/:type/:slug', async (req, res) =&gt; {
      const filePath = path.resolve(__dirname, &quot;./client/build&quot;, &quot;index.html&quot;);
      await fs.readFile(filePath, &quot;utf8&quot;, (err, data) =&gt; {
          if (err) {
              return console.log(err);
          }
  
          data = data
              .replace(/__TITLE__/g, &quot;Post title&quot;)
              .replace(/__DESCRIPTION__/g, &quot;Post description&quot;);
      
          res.send(data);
      })
  });
  
  app.use(express.static(path.resolve(__dirname, &quot;./client/build&quot;)));
  
  app.listen(PORT, () =&gt; {
      console.log(`Server is listening to port: ${PORT}`);
  }) 
  </code></pre>