I have two websites, websiteEN and websiteDE. They are both hosted on EC2 on their own instance. their urls are : website.en and website.de they use their own database websiteENDB and websiteDEDB.
I a currently using environment variables on AWS for their database.
To save money, I would like to host the two websites on the same instance. I would need to get the database name from the url which is used to navigate the website.
How can I get the url with an express server and pass it to my config variable ?
EDIT : Let's say for example that I have config.websiteDB = defaultDB If a user is visiting the website from website.de, I would like to have config.websiteDB = websiteDEDB and if she is visiting the website from website.en, config.websiteDB = websiteENDB