Adding a REST API to an existing C# Project

by user138741   Last Updated January 20, 2018 01:05 AM

I'm asking this question coming from a background of no experience in web development, so please be patient as I attempt to explain what I'm doing (if I use the wrong terminologies or if this has already been asked. Tried searching, but I don't exactly know how to concisely ask this question).

I have a server I've developed that handles requests from some embedded devices that my company builds. Currently, this server just acts as a file server, but it'll be a lot more in the future. Let's say for sake of example here that I want to build a webpage that gets the available files accessible to these devices, and displays them to the page.

I figure this is a job for a REST API, but I'm a bit confused over implementation details here. I see things as being as so: [devices] --> server <-- REST API <-- Webpage (arrows indicate which way requests flow).

So, here is where I get confused. Should I leave my server as it is, and build a connector class for the REST API, or is there a way to integrate a REST API into my existing project (or vice versa, implement the server into the REST API project). The way I've seen REST's built in all the tutorials I've followed they typically connect to a database with their model classes, from the controllers. I don't know how this plays out when the model isn't coming from a database (and as a result, no Entity Framework). I just figured I'd write a connector class that knows how to query my server over a socket to make a request for specific data, which would return it to the model, and then to the controller, and out the door as a HttpResponse.

I'd appreciate some input on this design here. My company is transitioning from doing desktop software into SaaS, and as such, no one in the company knows how to do this stuff yet and me and a coworker are pioneering the way (we are currently working through options for getting some professional development so we can learn best practices and such).

Tags : c# rest

Related Questions

Google CustomSearch API Image Search Not Working

Updated May 30, 2015 04:02 AM

RESTful way of requesting server generated resource

Updated March 31, 2016 08:02 AM