R
R
resuwenishe2016-10-22 17:25:09
Software design
resuwenishe, 2016-10-22 17:25:09

Are there any rules for building the architecture of a node.js application? For example, is it correct to pass a reponse object in a callback function?

For example:

app.post('/authorize',function(req, res){
    pg_queries.authorize(res); 
});

Passing response to a function in the request processing module
pg_queries.authorize = function (response) {
 if (...) {
 res.send(session-key); //используем переданный объект
}
};

Is it possible to somehow send a response to the user without violating the principle of asynchrony?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question