Problem resolving routes

I’m not sure what’s going on behind the scenes here but I’m experiencing some funky results with routes hitting the Service.Interface.Endpoints.

I have the following service models:

[Route("/find/questions/byquestion/{QuestionType}/byrelationship/{RelationshipType}","GET")]
public class FindQuestionsByQuestionRelationshipTypeRequest : IFindQuestionsByQuestionRelationshipTypeRequest, IReturn<FindQuestionsByQuestionRelationshipTypeResponse>
{
}

[Route("/find/questions/byquestion/{QuestionType}","GET")]
public class FindQuestionsByQuestionTypeRequest : IFindQuestionsByQuestionTypeRequest, IReturn<FindQuestionsByQuestionTypeResponse>
{
}

[Route("/find/questions/byrelationship/{RelationshipType}","GET")]
public class FindQuestionsByRelationshipTypeRequest : IFindQuestionsByRelationshipTypeRequest, IReturn<FindQuestionsByRelationshipTypeResponse>
{
}

[Route("/add/questions","POST")]
public class AddQuestionsRequest : IAddQuestionsRequest, IReturn<AddQuestionsResponse>
{
}

[Route("/get/questions","GET")]
public class QuestionsRequest : IQuestionsRequest, IReturn<QuestionsResponse>
{
}

[Route("/delete/questions","DELETE")]
public class DeleteAllQuestionsRequest : IDeleteAllQuestionsRequest, IReturn<DeleteAllQuestionsResponse>
{
}

[Route("/question")]
public class QuestionRequest : IQuestionRequest, IReturn<QuestionResponse>
{
}

These routes work but only because I prefaced the route with ‘/find/’, ‘/add’, ‘/delete’, ‘/get/’ etc. (which is a work-around) as I would like them to look like the routes below; however the following routes do NOT work as I never hit the ServiceInterface.Endpoint.

[Route("/questions/byquestion/{QuestionType}/byrelationship/{RelationshipType}","GET")]
[Route("/questions/byquestion/{QuestionType}","GET")]
[Route("/questions/byrelationship/{RelationshipType}","GET")]
[Route("/questions","POST")]
[Route("/questions","GET")]
[Route("/questions","DELETE")]
[Route("/question")]

Any ideas as to why I cannot start my routes with ‘/questions’ ???

I can’t repro this locally, but do you have a folder in your root project called /questions?

Hmmm… So two observations.

  1. I do not have a /questions folder anywhere in any of the projects; and
  2. I cannot reproduce this with an empty project (dotnet-new razor). Everything seems to work correctly. Taking these “working” models into my project cause it to break on my end.

The problem occurs in our Api.Gateway pipeline somewhere. I am attempting to put together a sample project that runs through our AppHost configurations but that is proving easier said than done. If I can get a project to run I will zip it and attach it for you.

1 Like

We have resolved this issue.

I was looking for a folder called ‘/questions’ which did not exist.

However, after searching further, it turned out the ‘/questions’ “folder” was actually our Api.Gateway Path variable. So once we change the Api.Gateway path from ‘/questions’ to ‘/questions-api’ all seems to be working again.

Thank-you for your insight, as your suggestion to look for the folder ‘/questions’ is what eventually led us to the realization that ‘/questions’ was in the Api Gateway Path property and eventually to our resolution.

Thank-you Sir!

1 Like