A
A
Anton Ulanov2016-02-17 00:08:57
Node.js
Anton Ulanov, 2016-02-17 00:08:57

How to make REST Api convenient in writing and further support?

Good time of the day. Point me in the right direction if I'm off course :) I want to write a rest service but for a large number of functions. Now I'm thinking of writing everything in router api.js which will be responsible for the todo module, calendar and so on. And then I began to doubt whether it is right to shove everything into one route, or is it better to divide it into apitodo apical and so on. Thanks in advance for your replies

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Dyrkov, 2016-02-17
@antonsr98

It is worth highlighting all the routes in a separate folder and breaking them into files. To access data, you need to write some kind of wrapper so that changing the database or schema does not affect the operation of the API. Always google "best practices", usually people share their experiences with others and this can be used to avoid doing bad things :)
Here's an example.

S
Sergey, 2016-02-17
Protko @Fesor

1) we write tests for the API
2) we do it as it is convenient, as long as we have tests, we can quickly fix it.
Separately, I recommend looking at jsonapi.org

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question