querystring.parse('foo=bar&baz=qux&baz=quux&corge')
// returns
{ foo: 'bar', baz: ['qux', 'quux'], corge: '' }
When I parse for the parameters on the server side, is there a way I can check if these parameters are sent in a correct sequence?
For example, I want to enforce that the foo=bar
is always the FIRST parameter and so on. How is this achievable?
Right now I can do something like:
var queryData = querystring.parse('foo=bar&baz=qux&baz=quux&corge');
But then doing
if(queryData.foo) {...}
only checks if the parameter 'foo' is present in the url, not if it's in the right place