Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array of usernames as parameter in GET Request - nodejs express

I need to send an array of user names in GET request as parameters, say

/show_user/?uname=user1&uname=user2&uname=user3&uname=user4

and then inside the express server.js file can I retrieve it as:

var username = req.query.uname;  //['user1', 'user2','user3','user4']

Will this work?

like image 953
Laxmi Sathy Avatar asked Mar 12 '26 09:03

Laxmi Sathy


1 Answers

Yes. Just send the attribute as your are doing and on the express side you can pull it out as

var username = req.query.uname;  //['user1', 'user2','user3','user4']
like image 51
Usman Mutawakil Avatar answered Mar 14 '26 00:03

Usman Mutawakil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!