SPA SEO dynamically updating metatags on node.js express route

I want to dynamically update my meta tags when a POST is received at /source/:uuid

I did:


    app.get('*', function(req, res, next) {
         const userAgent = req.headers['user-agent'] || ''; 
         if (isbot(userAgent)) next();
         else res.sendFile(path.join(__dirname, '/static/index.html'));
    });`

And the route:

   app.post("/source/:uuid", function(req,res){
          const userAgent = req.headers['user-agent'] || ''; 
          if (isbot(userAgent)){
              dbCall(data=>{
                   const raw = fs.readFileSync(path.join(__dirname, '/static/index.html'))
                   const updated = raw.replace('<title>The New Library of The Atlantis</title>',       "<meta name='description' content="
                   + "'Download" + data.format + " here!'><title>" data.title + "</title>")
                   return res.sendFile(updated)
              })

          }
          else{
               //browser code
          }
    })    

`

But curl and a browser bot checker shows the default meta from index.html

Any help?

I tried placing next() for bots in the * route before the source route and serving a custom index.html with new meta tags for the /source/:uuid POST route, but it’s not showing up when I check the bots.