-1
app.put('/sounds',(req,res)=>{
      var animal = req.body.animal;
      //from this api call I want to call 
      //app.get('/:animalname',(req,res)=>{res.render('animal.ejs')})
      })

I have already defined the app.get('/:animalname') above this api call.

How do I do that? Thanks!

Tan Ya
  • 29
  • 6
  • 1
    Does this answer your question? [Calling Express Route internally from inside NodeJS](https://stackoverflow.com/questions/38946943/calling-express-route-internally-from-inside-nodejs) – Kelvin Schoofs Jul 29 '21 at 18:12

1 Answers1

0

res.redirect('/endpoint') helps you redirect your request. You can read about it here: Link