I need to create url for get which is going to accept array, how in node.js/express extract array from request?

后端 未结 8 1119
感情败类
感情败类 2020-12-04 22:01

I need to create url for get which is going to accept array, how in node.js/express extract array from request ? I need to pass array with names which parametes I need to ba

8条回答
  •  无人及你
    2020-12-04 22:44

    If you want to pass an array from url parameters, you need to follow the bellow example:

    Url example:

    https://website.com/example?myarray[]=136129&myarray[]=137794&myarray[]=137792
    

    To retrieve it from express:

    console.log(req.query.myarray)
    [ '136129', '137794', '137792' ]
    

提交回复
热议问题