So i am new to node.js and I have come across this line of code that confuses me:
if (/^\/api\/parsetime/.test(req.url))
I understand the the test() part of it, but only the part before test is odd.
The exercises goal was to do something with the response from the server if the url of the request was to "/api/parsetime".
So basically my question is why is there /^\/
, \/
in the url when we put it in a if statement?
Thank you!
BTW, code was taken from NodeSchool workshop (learnyounode). Thank you guys you are awesome!