Node.js with EJS engine and URL variables

Dear Replit community!
I was going to create a Node.js project and wanted to know the best way to combine URL variables, Node.js server with EJS engine and Replit database in such a case. When a user opens URL, e.g.**account_name**, I want to be able to extract “account_name” part from it, then (on server side) use it as a key to access some data in Replit database and finally render a page and pass the data that I’ve just accessed to it. For example, a user goes to a page**adam123**, a request to render this page is sent to server, server extracts “adam123” part, accesses the database to get adam123’s name and date of birth (for example), and finally renders a page and passes previously accessed name and date of birth to the page. On the rendered page this data is saved into JS variables and displayed.

How can I achieve that? Or should I better use classic router instead of EJS? (more info on EJS here: NodeJS Setup With Express, HTML, CSS, JS & EJS - Raddy and here: How To Use EJS to Template Your Node Application | DigitalOcean).