Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api-server): Add NanotronUrl class for handling client request URLs
This commit adds a new file, `url.ts`, which contains the implementation of the `NanotronUrl` class. This class extends the `URL` class from the `node:url` module and provides additional functionality for handling client request URLs in the Nanotron API server. The `NanotronUrl` class includes a static property `versionPattern_` which is a regular expression used to match and replace the version prefix in the URL. It also has properties `method` and `debugId` which store the HTTP method and the debug ID of the request respectively. The constructor of the `NanotronUrl` class takes a `clientRequest` object of type `IncomingMessage` and a `prefix` parameter which represents the URL prefix. It modifies the URL by removing the prefix and replacing the version prefix with a single `/`. The modified URL is then passed to the `URL` constructor along with a default base URL. This commit enhances the functionality of the Nanotron API server by providing a dedicated class for handling client request URLs. This improves code organization and maintainability.
- Loading branch information