The application I am writing reads folder contents, when given the folder path. The webpage calls methods of an API, which returns JSON, and then JavaScript displays the response on the webpage.
This API endpoint needs to have deep linkable URL pattern. What I understood is that the application can be called like this: https://localhost:1111/index.html/c:/folder1/folder2/folder3
. Then JavaScript sends the path c:/folder1/folder2/folder3
to the endpoint and gets the response.
My endpoint works fine in Postman and Swagger. The endpoint works with and without the path. When no path is sent, it returns contents of the default path which is in the appsettings.json
. In addition, the webpage contains a textbox which can take a folder path on the hard drive and successfully gets the response.
The problem I am facing is that (according to my understanding), I cannot read the URL like this: https://localhost:1111/index.html/c:/folder1/folder2/folder3
. This (https://localhost:1111/index.html
) works but if I put the path, I get 404. The controller is set up to take no or multiple folders like this:
[HttpGet("loadfolder/")]
[HttpGet("loadfolder/{*folder}")]
If I use querystring, then it won’t be a deep linkable URL pattern. I am not sure if I have to write a middleware for route configuration.
15