Use the built-in url module which is available in Node.js to parse the URL and create a urlObject. This will have a hash fragment property containing the hash fragment you want.
const url = require('url')
const urlObj = url.parse(req.url)
console.log(urlObj.hash) // #some/url