|
All the angles in heaven?
|
|
|
|
|
I am fairly new to development and have been asked to look at creating a MVP Rest Web Service so our clients can query a database. I am looking for advice. I have scoured the internet but have not found a lot of specific examples. Any help or advice would be gratefully received
|
|
|
|
|
So, assuming that by MVP you mean Model-View-Presenter, you're highly unlikely to find much as far as examples go. For one, the in-vogue architecture for web applications is actually a cousin of that pattern, the MVC (Model-View-Controller) architecture. Second, web services are intended to exist at the data access layer and (at least partially) the business logic layer of n-tier applications, so presentation logic is not a consideration for a pure REST API.
Suggestions for frameworks or platforms will depend on what language you intend to use. You might want to ask in the language-specific forums about what technologies might give you a head start.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Thank You Nathan for your reply and advice.
I am sorry i should have mentioned that I am looking to write this in c#.
The internet is saturated with examples using Model View Controller and seems the way to go but for some reason I have been asked to use Model View Presenter, which on the face of it seems strange.
As it does not seem to easily translate to Model View Presenter.
I will look c# forums to see if this is possible.
Thank you again for your time and advice
|
|
|
|
|
REST services have controllers, the endpoint is in effect the controller.
To me it makes no sense to have a presentation layer or a view layer quite simply because REST does not serve a page but serves a response which will contain a header and a body generally containing JSON rather than HTML with CSS.
One pattern for a REST service is:
Controller - the endpoint
Orchestrator - receives request from the controller and serves response to the controller
Repository - basically the database connection
Model - a structure defining the data within requests and responses
MVC and MVP are patterns used for web pages - I have not seen those patterns used for REST services.
[I stand corrected by my post below where I have posted a tutorial to a Microsoft Web API MVC tutorial)
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 21-Apr-19 15:31pm.
|
|
|
|
|
Thank you very much Guy for your advice and time.
|
|
|
|
|
|
Thank you very much Rick for your advice and time.
|
|
|
|
|
Maybe you're being asked for a "desktop" front end to a web service; in which case MVP sounds more reasonable (for the desktop app part).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Well, MVP is a pattern, not a technology.
Choose the technology that best solves the problem (take a look at Web-Api). And make sure you follow the pattern.
|
|
|
|
|
Julian Michael wrote: MVP Rest Web Service Re-reading your post I wonder if you have misunderstood what the person asking you to do this work meant by MVP.
MVP can mean Model View Presenter or it can be Minimum Viable Product - I am going to put my bet on it being the latter.
I which case there will be Microsoft tutorials out there for how to create a WEB API REST service.
Where things get a bit tricky is the security side. You can usually knock up a basic REST service in a couple of hours.
Security considerations can add a bit of time to a project.
Tutorial: Create a web API with ASP.NET Core MVC | Microsoft Docs[^]
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Thank you Guy for the pointer, I have been spending a lot of time researching and the best route i believe would be using WEB API is the solution but wondered whether choosing .net or core would make too much of a difference. I understand core is new and cross platform
|
|
|
|
|
I agree with you regarding Web API.
As for .NET core it's not something I have experience with.
I would suggest not using it to begin with as it's probably worth getting something working with standard .NET and then if you really need to you can investigate porting it to core.
The reason I say this is because I am aware that core did require some workarounds in the past, which may now be fixed. You only really need to use core if you are not going to be hosting the API on a Windows server.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 22-Apr-19 3:12am.
|
|
|
|
|
Thank you again Guy.
.net it is
Have a good Day......
|
|
|
|
|
You're welcome
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
To be honest, for REST I would advise .NET Standard or .NET Core as opposed to the old framework. It's faster, leaner, more likely to be supported and has some great enhancements in the way it takes care of HTTP lifetime.
This space for rent
|
|
|
|
|
I hadn't even thought of that. Silly business acronyms crossing into ours.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Ask and thou shalt receive:
/ravi
|
|
|
|
|
I know you meant well, but that article works best to build a basic demo or POC, it's not demonstrating production ready code.
|
|
|
|
|
Right. I thought a basic tutorial like this one would be more suitable (for someone who's new to development) to get started, than an in-depth discussion of the subject or an SO article.
/ravi
|
|
|
|
|
|
The trouble is that a certain person who lives in a certain-coloured house is making his "peeps" cry wolf so often that risk reports are no longer trusted.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Got here yesterday, so much to see and do. Went to the Vatican museum first thing, very beautiful but I had no idea everyone on the planet would be there.
I do all my own stunts, but never intentionally!
JaxCoder.com
modified 21-Apr-19 3:38am.
|
|
|
|
|
I thought you were going to Italy?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Had to make a slight detour, but back on track now.
I do all my own stunts, but never intentionally!
JaxCoder.com
|
|
|
|