matthewrenze / clean-architecture-demo

A sample app for my online course "Clean Architecture: Patterns, Practices, and Principles" in .NET Framework 4.8
BSD 3-Clause "New" or "Revised" License
1.03k stars 481 forks source link

Use webapi on Service layer #3

Closed edgarvalcarcel closed 6 years ago

edgarvalcarcel commented 6 years ago

Hi Matthew,

I watched your course, and I studied your project. I liked it very much. I would like used in real life, but there is something rare on the service layer : Where can I create a HttpGet or POST service in this layer? I'd tried this on the Get method:
[HttpGet] public IEnumerable Get() { } on EmployeesController.cs(CleanArchitecture.Service.Employees), this route must be : http://localhost:49581/api/employees/Get/1, I think so, but It doesn't work, in this kind of project how is the route template in the URI for API services ?

same case for http://localhost:49581/api/Sales/Get/1

Thanks,

Edgar V

matthewrenze commented 6 years ago

Edgar,

In order to access the sales endpoint, the URL (from my local machine) is http://localhost:49164/api/sales/

This should return the following content in your browser: employees

To access a single sale entity, the URL (again from my local machine) is http://localhost:49164/api/sales/1

This should return the following content: employee 1

Be sure that you first right-click on the Services project and click "Debug". The solution is set up to only debug the Presentation layer by default, so you need to manually run the Services project in debug mode to hit these endpoints.

Hopefully this helps.

Best of luck,

Matthew

P.S. Thanks for the feedback on the course and the project. I really appreciate it! : )

edgarvalcarcel commented 6 years ago

Matthew thank you for your answer, it will be useful.

EDGAR


De: Matthew Renze notifications@github.com Enviado: miércoles, 11 de abril de 2018 7:08 p. m. Para: matthewrenze/clean-architecture-demo Cc: Edgar Valcarcel; Author Asunto: Re: [matthewrenze/clean-architecture-demo] Use webapi on Service layer (#3)

Edgar,

In order to access the sales endpoint, the URL (from my local machine) is http://localhost:49164/api/sales/

This should return the following content in your browser: [employees]https://user-images.githubusercontent.com/6383103/38649237-0f08b988-3dbb-11e8-8d9e-13b316887f9c.png

To access a single sale entity, the URL (again from my local machine) is http://localhost:49164/api/sales/1

This should return the following content: [employee 1]https://user-images.githubusercontent.com/6383103/38649294-5b6c59d8-3dbb-11e8-85ac-c8045bf19d03.png

Be sure that you first right-click on the Services project and click "Debug". The solution is set up to only debug the Presentation layer by default, so you need to manually run the Services project in debug mode to hit these endpoints.

Hopefully this helps.

Best of luck,

Matthew

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/matthewrenze/clean-architecture-demo/issues/3#issuecomment-380633540, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHci0nwz4D5FBon2U597XYQNIhwdrB8iks5tnpr3gaJpZM4TJFP0.