Sobes.tech
Junior — Middle

Have you applied REST principles in implementing a service or system?

sobes.tech AI

Answer from AI

Yes, when developing REST services in Node.js, I applied the main principles of REST: using HTTP methods (GET, POST, PUT, DELETE) for resource operations, clearly defining URIs for resource identification, and using HTTP status codes to convey the request result. For example, for working with the "user" entity, I created routes:

app.get('/users', (req, res) => { /* get list of users */ });
app.post('/users', (req, res) => { /* create a new user */ });
app.put('/users/:id', (req, res) => { /* update user by id */ });
app.delete('/users/:id', (req, res) => { /* delete user by id */ });

I also tried to make the API stateless so that each request contains all the necessary information for processing, and used JSON as the data exchange format.

Have you applied REST principles in implementing a… - sobes.tech