Closed KrisGray closed 6 years ago
Just for completeness here is the dir structure
/var/www/src/perl5/pace_api/
├── lib/
│ ├── PaceAPI/
│ │ ├── Controller/
│ │ │ ├── User.pm
│ │ │ └── Wibble.pm
│ │ │
│ │ ├── Model/
│ │ │ ├── User.pm
│ │ │ └── Wibble.pm
│ │ │
│ │ ├── Service/
│ │ │ ├── User.pm
│ │ │ └── Wibble.pm
│ │ │
│ │ ├── Controller.pm
│ │ └── Service.pm
│ │
│ └── PaceAPI.pm
│
├── public/
│ └── pace_api.json
│
└── script/
└── pace_api
It seems like you have some code that mess up $app->routes->namespace
. There’s no code in OpenAPI that changes that value.
https://mojolicious.org/perldoc/Mojolicious/Routes#namespaces
Thanks for the quick reply. I don’t see anything in my code that messes around with the namespace. I have solved the issue however by preloading the app in a startup script using Plack::Handler::Apache2.
In the apache devel.conf I have the following:
The pace_api script has the following code within:
The PaceAPI has the following:
The config OpenAPI file public/pace_api.json is as follows:
To begin with everything works as expected but as soon as all the apache children have ran the pace_api script and starts to reuse the child apache processes while using a different GET method call. Mojolicious seems to forget about the OpenAPI plugin and the routes it has created.
With debug on I see the following:
As you can see in the log for some reason the "Routing to a callback" starts to use "PaceAPI::User" rather than "PaceAPI::Controller::User". I have tried for a couple of days to solve this issue but I am not getting anywhere. It would be so appreciated if you could give me any feedback into why this is happening and how to fix the issue.
Many thank,
Kris