2023 Jul 05 11:53 AM
Hi
I have defined a route in xs-app.json file for the path /mealapi/docs.
When I use the URL: http://localhost:5000/mealapi/docs/, it works just fine and shows the required page.
The problem appears when I don't use the trailing slash (/) i.e., URL: http://localhost:5000/mealapi/docs
It automatically redirects me to the URL: localhost:5000/api/docs/ and I am not able to figure out what's the reason behind this behavior.
I have tried every possible way out to get to the same page when trailing slash is not used but no luck.
Below is my xs-app.json:
{ "authenticationMethod": "none", "routes": [ { "source": "^/mealapi/docs(.*)", "destination": "meal-srv" } ]}
default-env.json:
{ "destinations": [ { "name": "meal-srv", "url": "http://localhost:1000/" } ]}
I have an endpoint in meal-srv which serves the swagger documentation:
app.use( "/mealapi/docs", swagger.serve, swagger.setup(swaggerDoc.SWAGGER_DOCUMENT));