In a service like Heroku, you are given a database url such as postgres://username:password@localhost:5432/my_db. But what if you need to chop this up to get just the scheme, username, etc.?
Node.js has a built in module called url that has a parse method. You can try it out with a database url:
Here you can see an output of keys and values that we need:
We can use that as a reference for chopping everything up in the database url. First, the scheme (or protocol):