How to get URL of current page in NodeJS

This is what I have done so far

But this gives me the URL of the API file.

The actual aim of my effort is to get just the pathname for the current page as in /about so that I can use it to filter the database.

What am I doing wrong?

Community Page
Last updated: