danieleteti / delphimvcframework

DMVCFramework (for short) is a popular and powerful framework for WEB API in Delphi. Supports RESTful and JSON-RPC WEB APIs development.
Apache License 2.0
1.23k stars 356 forks source link

How do I access the "root" path? #760

Open Margera opened 2 months ago

Margera commented 2 months ago

I'm creating a controller with some information and redirections that are as "root". However, the DMVC response is always 404.

Sample:


[MVCPath('/')]
  TAboutController = class(TMVCController)
  public
    [MVCPath('/')]
    [MVCHTTPMethod([httpGET])]
    procedure Redirect;

      // OR

    [MVCPath]
    [MVCHTTPMethod([httpGET])]
    procedure Redirect;

    [MVCPath('/about')]
    [MVCHTTPMethod([httpGET])]
    procedure AboutAPI;
end;

In short, this access doesn't work "http://localhost:52146/", this one also doesn't work "http://localhost:52146/about"

I noticed that there are some examples implemented this way, but they don't work either. So how can I do this?

danieleteti commented 2 months ago

Which samples don't work?

Il Ven 12 Lug 2024, 21:33 Bruno Silva @.***> ha scritto:

I'm creating a controller with some information and redirections that are as "root". However, the DMVC response is always 404.

Sample:

` [MVCPath('/')] TAboutController = class(TMVCController) public [MVCPath('/')] [MVCHTTPMethod([httpGET])] procedure Redirect;

// OR

[MVCPath] [MVCHTTPMethod([httpGET])] procedure Redirect;

[MVCPath('/about')] [MVCHTTPMethod([httpGET])] procedure AboutAPI;

end; ` In short, this access doesn't work "http://localhost:52146/", this one also doesn't work "http://localhost:52146/about"

I noticed that there are some examples implemented this way, but they don't work either. So how can I do this?

— Reply to this email directly, view it on GitHub https://github.com/danieleteti/delphimvcframework/issues/760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK4ZJCRHL66ZX4YXOJHAOTZMAVPVAVCNFSM6AAAAABKZPB2TOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYDMMRRGUZTINY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Margera commented 2 months ago

the project "..\samples\authenticationauthorization" is an example, in this project we have the controller AppControllerU with the "procedure TApp1MainController.Index" which is a direct call to a "root" (http://localhost:8080/).

In this situation, the return is "NotFound" image

Another example project is "_..\samples\custom_exceptionhandling" which has the procedure TMyController.Index; as "root".

It's important to mention that I'm using version 3.2.2(nitrogen) with Delphi 10.1

danieleteti commented 2 months ago

Both examples (the first one is no more contained in the project, howver I tested basic_demo_server which does almost the same thing) work in 3.4.2-magnesium-rc2. Can you create a very simple self-contained test which reproduce the problem? We have to understand if it is a Delphi 10.1 issue or a dmvcframework-3.2.2-nitrogen issue.