Rest API node - Parameter in between

63 Views Asked by At

I know this is Novice question but couldnt find a best way to do it.

I want to build a rest API with paramater inbetween like

/api/blogs/:blogid/articles/:articleId

I want to route to proper method and identify both blogid and articleid and return response.

Thanks and Best Regards Moyeen

1

There are 1 best solutions below

2
On
.post('/api/blogs/:blogid/articles/:articleId',
        function(req,res){
       Console.log(req.params.blogid)
       Console.log(req.params.articleId)
       }

In this Api .. Request parameters will give the desired results

Sorry for indentation using mobile app And do up vote if helpful ... :)