Tag Info

New answers tagged

2

If you want to test your code independently of NodeJS, create a service layer or repository layer that contains an API you can call on one side, and Node.JS calls on the other. You can use your stubs or mocks on the methods in that layer, or even swap out the entire implementation of the service layer if that works for you. What you test is the same as it ...


0

Should I host my site out of Nginx/Apache and use Node as simply a "data" server, funneling data through JavaScript on the client to update the site HTML? Something should be responsible for the port 80. It should be either Nginx/Apache or Node. If you're going to use Node you can use it as your webserver. Should I host it all through Node, adding ...


1

Should I host my site out of Nginx/Apache and use Node as simply a "data" server, funneling data through JavaScript on the client to update the site HTML? Many people recommend this exactly. This article is about yesod, but I think it applies: As fast as Warp is, it is still optimized as an application server, not a static file server. ...


1

The nesting is a little hard to read. If you write it as follows, it's easier to tell what's happening. function queryDatabase() { query.getResult({query: resourceQuery}, queryDone); } function queryDone(err, result) { if (result.length !== 0) { q.resolve(result); } else if (timeoutCounter++ > timeoutLimit) { q.reject(); ...


5

JSON representation can be dense, certainly denser than a flat list of properties, so memory exhaustion and denial of service may be slightly easier. Other than that, assuming your JSON parser is bulletproof, you're left with basically the same attacks that can be directed at a form-data or query-string based entry point, primarily various kinds of string ...


0

With non-blocking code, you can issue a request for file-system or database, then instead of waiting for the response, you go on and serve another user and then another. Later you come back to first user (whose request was pending) and you serve him. In summary, this is something like this: user1 makes a request -> Node issues a call to file-system or ...



Top 50 recent answers are included