A
A
Alex Kheben2014-08-14 21:23:43
JavaScript
Alex Kheben, 2014-08-14 21:23:43

How and where to find modules for Node.js to organize a kosher REST API?

Stupid limitation on the title of the question... The original question is: "What are the modules for Node.js to organize a kosher REST API?"
So that the response code differs from 200 for different request methods (POST, GET, PUT, DELETE).
To support Range out of the box.
Filters are also desirable, but not critical.
Tried Sails.js and didn't find a way to implement Range support without rewriting the controller.
I also tried Loopback, it didn’t even work out there to find a quick solution to support different statuses for different requests.
So far, from the tried options where you can do everything the way I want it: express.js and restify. But they are more low-level than sails.js and loopback. So I have to write a lot...
Maybe there are other options?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
O
Oleg Serykh, 2014-08-15
@seryh

Sorry for the offtopic, but I would advise you to use the JSON RPC API ( www.jsonrpc.org/specification ), it is more native for the node. Yes, and subjectively more convenient than REST

T
Timur Shemsedinov, 2014-08-15
@MarcusAurelius

REST is the greatest obscurantism and insanity of all times and peoples. Take RPC as advised. On the bare primitive HTTP mechanism with its underdeveloped set of POST, GET, PUT, DELETE verbs that cannot be extended and customized, it is difficult to develop something more complex than working with files or database records using the CRUD principle (CREATE, READ, UPDATE , DELETE). When you need to do at least something more, over the resource, introduce your own verb, then the whole ideology collapses. For example, I have an oil pipeline with main pumping units, and I need to control the closing and opening of valves, the parameters of pressure regulators, cathodic protection monitoring, and other subsystems. Should these commands be sent via POST or PUT? Funny, right? Here you need 5000 verbs / methods to enter over 20 resources, not 4 unfortunate verbs over an uncountable number of resources. Or even over the data in the DB, I need new verbs, for example, I want to create a relationship between two objects or give the user permission to change an object parameter or run a pending report generation task on the server, just run and get a predicted completion time in response, how to do it on REST? I'm not talking about the fact that operations may not be over resources at all. Operations can be on sets, queries (filters, selections, cursors), on a state machine, on links between several resources, on the system as a whole, or on data flows, events or technological equipment in general. I want to create a relationship between two objects or give the user permission to change an object parameter or run a delayed report generation task on the server, just run it and get the predicted completion time in response, how to do it on REST? I'm not talking about the fact that operations may not be over resources at all. Operations can be on sets, queries (filters, selections, cursors), on a state machine, on links between several resources, on the system as a whole, or on data flows, events or technological equipment in general. I want to create a relationship between two objects or give the user permission to change an object parameter or run a delayed report generation task on the server, just run it and get the predicted completion time in response, how to do it on REST? I'm not talking about the fact that operations may not be over resources at all. Operations can be on sets, queries (filters, selections, cursors), on a state machine, on links between several resources, on the system as a whole, or on data flows, events or technological equipment in general.

Y
Yuri Puzynya, 2014-08-19
@3y3

You can look towards loopback . That's where the buns are in abundance.

S
Sergey Krasnodemsky, 2014-08-15
@Prognosticator

connect-rest

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question