I may have gotten myself confused, when reading CRUD vs REST and how they are similar, so I wanted to explicitly ask: can I turn my CRUD application into a REST application, when I have a specific scenario, and will doing so be of any benefit?

My existing CRUD application uses data in a MySQL table that is mostly passive, but from time to time it needs to be updated. In my case the data represents various dimensions and specs of a motor that are changed or corrected from time to time. There is also a similar but "higher in concept" use case where instead of modifying the data in-place, it is versioned and historical records are kept. That is, say the current "row" of data is first inactivated, but is otherwise left in the database, and a new row of data is added with a new version number, which is then made active. That new data is then read for any future motor computations.

The CRUD has the following parts: * HTML form, submitting which transfers data to an "add/edit" script, which redirects to "view" script that shows the added/updated data.

I don't have a clue of how to convert this into a REST application or if I need to, or of doing so will make my life or someone's life better.

Can I have a more concrete example of what it will mean to convert my particular use case from CRUD, to REST? Will I need to change any URLs, interfaces, event handling, etc?

  • 2
    I think you're confusing things. CRUD vs REST are nearly orthogonal concepts. REST is a data interface. Use REST if you are going to have web-based clients talking to it, but your application at heart will still be a CRUD app. – whatsisname Sep 13 '18 at 16:09
  • by web based clients do you mean automated clients or can it be clients driven by humans? In my case I have users of the app who use web clients (browsers) to access the app via HTML interfaces over HTTP... – Dennis Sep 13 '18 at 16:13
  • @whatsisname: Actually, REST is an architectural style, not a data interface. If you want a data interface, try HTTP. If you want a data protocol, try JSON. – Robert Harvey Sep 13 '18 at 17:07
  • @RobertHarvey: a style for an interface, not an application architecture. You can bolt a REST interface onto just about anything, it imposes few to no requirements on how the underlying system works. – whatsisname Sep 13 '18 at 18:07

CRUD is a term that refers to the four most used activities in Data Oriented Applications: Create (Add, New), Read (Get, GetList), Update (Modify), Delete (Remove). In terms of Database the CRUD maps the Insert, Select, Update & Delete SQL-DML (Data Manipulation Language) commands.

REST (Representational State Transfer) is a term used in Web Application Development that specify the features or restrictions that HTTP RESTFul Services should have into account: (1) Client-Server, (2) Stateless, (3) Cacheable, (4) Uniform Interface & (5) Layered System, (6) Code On Demand.

A well-formed Layered Architecture for Web Apps most times includes three layers, Fronted, Middleware & Backend. REST services can be built on the Middleware or directly in Backend. Suppose for example you're thinking on build your App over Strong Standardized Frameworks, let’s suppose that the Frontend will be build using Googles Angular JS, Middleware services will be build using Node JS & Express JS and Backend will rely on .NET Web API.

REST uses HTTP verbs to map CRUD operations: GET (Read), POST (Create), Put (Update) & Delete (Delete). The key here is that RESTful compliant services uses HTTP Verbs to perform CRUD operation. In the Frontend side, the JavaScript code for consuming the REST service migth be similar to:

angular.module('RESTApp', [])
.controller('CtrlUsers', function($scope, $http) {
    $http.get('http://appdomain.restAPI/users', {id: 1}).
        then(function(response) {
            $scope.data = response.data;

Finally most recent structural patterns for define Layered Applications uses Model View Controller (ASP.Net MVC, Spring MVC, PHP Laravel,...) Design Pattern. In the data access case well know ORMs Frameworks such as .Net Entity Framework or Hibernate are used to access relational databases. All this stuff must be understand in order to design & construct well-formed RESTful Applications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.