Tagged Questions

Node.js is an event-based, asynchronous I/O framework that uses Google's V8 JavaScript engine.

learn more… | top users | synonyms (1)

2
votes
1answer
68 views

Callback functions: Semantics and maintainability, when they aren't necessary [duplicate]

Within the context of JavaScript/Node.JS; Will using Callback functions improve the maintainability of source code, when there is no need for async programming? For example does the plain code sound ...
-2
votes
0answers
19 views

bower flat dependency tree

I installed bower recently and read this description from the website: Bower uses a flat dependency tree, requiring only one version for each package, reducing page load to a minimum. What do ...
0
votes
1answer
48 views

Why is it bad if view engines encourage logic in templates

I once read this, because I wanted to see if handlebars is the right view engine for me or rather something else. A thing that I wonder since then is the following, why is it considered bad, if a ...
0
votes
0answers
4 views

Error: Connection lost with SQl in node.js [migrated]

I'm using felixge/node-mysql module in my server to connect to the local database. After a while, it throws an error: Error: Connection lost: The server closed the connection. at Protocol.end ...
-1
votes
0answers
32 views

Problem with node.js and server.js [migrated]

I'm a bit stuck right now, and hoping someone can shed some light. I'm relatively new to sockets in general, but have been programming in javascript on and off for several years, although only about ...
0
votes
0answers
60 views

Node.js, Client side web cache

So, I am not expert at Node.js, but from what I was looking at with Node.js it seems possible. I am trying to cache data (A and B below) on the client (client 1 below) so that I can get that data on ...
1
vote
1answer
56 views

NodeJs website webapp architecture

I would like some advice on how best to architect a website comprising the following: tool a landing page, open to the public, main marketing tool the main website/app, that people can access only ...
0
votes
0answers
13 views

How to define dependent function in node js?

I have a nodejs project in which a sample.js include two function function A depends on function B's callback . // smaple.js Both function are included in the same file function B ( ...
0
votes
0answers
92 views

Unit Testing: Pass in Modules or Entire Codebase?

In unit testing, the idea is (I think, correct me if I'm wrong) to unit test a module, then integration test these modules together, then integration test the respective "regions" of modules you ...
-1
votes
1answer
131 views

Create fake HTTP server to simulate an API for testing

I'm looking to mock responses from an external API service that returns JSON during live events. The first response would contain (fake) events that have happened up to time X, the second response ...
1
vote
1answer
338 views

Erlang chat app design?

I have a chat app made in node/socket.io. Scalability factors have made us choose Erlang/Ejabberd/xmpp and it will replace node/socket. I have a few questions: Currently using MySql for chat ...
3
votes
1answer
99 views

Is my websocket session idea practical?

In a situation where all communication (including logging in) between a client (web browser) and server is done over a persistent TLS encrypted websocket, would there be anything inadvisable about ...
0
votes
0answers
64 views

Node.js on Apache server (Shared Hosting)

I would like to run Node.js/Express as a backend server mainly for handling WebRTC features in my app. I was just discussing this with my hosting provider and they rejected this request saying that ...
0
votes
2answers
127 views

In Node.js, are non-blocking constructs usually preferable to blocking ones?

Is the following a statement of best practices in Node.js with regard to web applications? If not, how could it be improved? The statement The lifecycle of any web app has at least two phases: a ...
0
votes
0answers
74 views

Is this right in the use case of exec method of child_process? is there away to cody the envirorment along with the require module too?

I'm learning node. I am using child_process to move data to another script to be executed. But it seem that it does not copy the hold environment or I could be doing something wrong. To copy the hold ...
4
votes
1answer
117 views

Are promises suitable for Model Controller communication?

I have an Express app built with the Yeoman Angular fullstack generator to build an API to send JSON to Angular. I'm trying to work out the best way to pass back information from my model to my ...
5
votes
3answers
298 views

The nature of callbacks in Node.js

In the plain javaScript world I've learned that nested functions can be problematic because the inner function is "re-created" every time the outer function is called: function outer(a) { ...
0
votes
4answers
233 views

Is client side JavaScript capable of replicating the Node.JS module loading system?

I like the Node.JS style of JavaScript, where I can write all of my functionalities into smaller files and then require those neatly from within my code. I'm even thinking about trying to write a ...
0
votes
1answer
152 views

How to tell node.js which javascript code runs on server vs client?

I am trying to learn the theory of node.js but can't seem to figure out how node.js knows whether to pre process it on the server or send it to browser for execution.
3
votes
1answer
94 views

Testing gap between unit and integration: Integration in the Small, Component, Unit Integration Tests

Over the past few weeks I've been mulling and researching how to fill a gap in our testing methodology. In simplified terms unit tests are too small and traditional integration tests are too big. A ...
2
votes
1answer
77 views

Wrapping function in closures to make testable functions

In my nodejs project, I have functions like this for socketio. socket.on('draw', function (data) { socket.broadcast.to(socket.room).emit('draw', data); addEvent(socket, ["draw", data]); }); ...
0
votes
2answers
160 views

confusion on using nodejs within an actual web application or ide

I am new to using nodejs completely, and it seems to be pretty much the go to thing for everything right now. But I program in Visual Studio, and I'm a bit confused about how this works. I will cite ...
2
votes
2answers
73 views

How to handle versioning with multiple independent pull requests in a Git repository?

Let's say Alice has a Git repository, and the version is kept track of inside the repository (let's say package.json for npm). Bob sends a pull request to Alice which increments the version number ...
-2
votes
1answer
144 views

Would you get better performances by coding an application in C, then compile to JavaScript? [closed]

I am writing an interpreter for a functional programming language that is going to run in the browser. Needless to say, performance is the one and only concern in this application. Emscripten is an ...
0
votes
0answers
61 views

Declarative Transactions in Node.js

Back in the day, it was common to manage database transactions in Java by writing code that did it. Something like this: Transaction tx = session.startTransaction(); ... try { tx.commit(); } catch ...
2
votes
0answers
73 views

Managing setTimeouts and setInterval in a distributed environment

I am building a turnbased game on nodejs using socket.io and redis as the datastore. I am planning on hosting the game on AWS opsworks with the ability to scale by adding more nodes. How should I ...
0
votes
1answer
97 views

How to unit test models in MVC / MVR app?

I'm building a node.js web app and am trying to do so for the first time in a test driven fashion. I'm using nodeunit for testing, which I find allows me to write tests quickly and painlessly. In this ...
2
votes
2answers
513 views

How to represent a tree structure in NoSQL

I'm new to NoSQL and have been playing around with a personal project on the MEAN stack (Mongo ExpressJs AngularJs NodeJs). I'm building a document editor of sorts that manages nodes of data. Each ...
3
votes
1answer
225 views

How significant is node's advantage of training developers in only one language and putting them on tasks across the tech-stack? [closed]

I have recently joined a startup as CTO/co-founder. The startup and I have been thinking about moving the existing codebase (which is in PHP5.5, laravel framework) to node.js . Main reason for this ...
0
votes
0answers
859 views

How to parse multipart field/file data separately?

I want to parse a multipart form twice: Once to grab the incoming fields, and later to process the file upload. I am trying to maintain a proper separation of concerns within my Node app: ...
1
vote
0answers
179 views

How to authenticate user on php and Node.js

I´m currently developing a little chat page. The main page and user management is written in php and also all the authentication stuff with sessions. Now I´m planning to run the messaging stuff on a ...
4
votes
3answers
361 views

Dividing responsibilities between client and server

I'm working on a Web app that uses node.js on the server and AngularJS on the client. I'm new to Angular, but enables writing client-side applications that can be more self-contained than some other ...
1
vote
2answers
284 views

Programmatically syncing with remote servers

My application generates text files that need to be synced with remote servers, which may be windows or linux. Sync has to happen without user's intervention. I tried with rsync but windows doesn't ...
0
votes
0answers
233 views

Optional dependencies in npm?

I have a similar question to this, but not quite the same. I would like for the user of my app to install it with whatever dependencies are needed for the way he would want to use it. So, for ...
2
votes
1answer
524 views

How can I keep Web services requests in a DAO layer without tying the code to the DOM?

I'm working on a single page application on the node-webkit desktop app platform, which means 99.9% of all of the logic is written in JavaScript. Since this is a reboot of a project we're working on, ...
0
votes
1answer
58 views

What to test in this project?

Every developer advocates test-driven development, but I am coding a website in NodeJS and I am not testing my app. This is not because I don't see any reason. I know it allow me to check at each ...
0
votes
0answers
106 views

Is my application secure enough

first of all, I don't have any code to display in my question here, because I'm still designing the application structure, so i only got design developed. I'm building a phone application that I'm ...
0
votes
0answers
53 views

How to store progress of abstract events?

I making a game in node.js. I have players and they can perform a lot of actions. Actions are all coded as functions, and they change certain variables in either User object or other objects that ...
1
vote
2answers
708 views

Developing a dynamic site with Node.js [closed]

I'm trying to get some pointers on what the best methodology to follow for a web application would be. First, some background: I've built two different APIs using Node.js where Node serves the data ...
3
votes
1answer
661 views

Utilising Promises, Closures and Recursion in Node.js

I have employed a recursive call to a closure in order to mitigate against some race conditions I am getting (That's what I think it is). I'd like to know if (and why) this is a good solution or a bad ...
1
vote
1answer
214 views

Is parsing a submitted JSON object safe?

I have a RESTful API, built in NODE.js that does what you would expect it to: consumes data and then makes it accessible. Currently, data being submitted to my server is nested form data: ...
0
votes
2answers
2k views

Understanding Front End vs Back End Javascript?

I've been noticing lately, as I've played around with javascript, HTML5, and node.js for the first times that javascript seems to be a language that is used very differently (and with different ...
0
votes
2answers
196 views

Making server logic independent of client interaction

I'm trying to make a realtime multiplayer web-game in node.js with express framework and socket.io library. But I can't seem to make my server-side logic independent of client interactions. I want ...
0
votes
0answers
391 views

Looking for changes in a MySQL database with node.js for a live dashboard

So, I work for a NOC in a small ISP. We're planning on getting a large wall mounted monitor and I'd like to make a dashboard in Node.JS - I've never used node before so it should be interesting. I'm ...
0
votes
1answer
211 views

Design questions for a Node.JS based Dashboard

I checked with meta and apparently this is the best place to ask! The company I work at have many environments, and as such, many Nagios/Icinga etc boxes in each environment. We currently have a ...
1
vote
3answers
406 views

Why should I use node.js as http server?

I know what node.js is & what it does. What I really want to know is how does it work as an http server? A server like apache gets a request, fork a process, allocate memory to process, handle ...
4
votes
2answers
342 views

Why might I switch from ASP MVC to Node/Express?

So I've been wanting to try Node and Express. Not to mention Jade and Stylus. Webstorm has in my opinion an amazing user experience and I want to use it and these technologies. Here is where I get ...
0
votes
0answers
314 views

How can resolve an URL on a specific DNS server

I'm currently facing a issue on a project. I'm resolving URL's on multiple DNS servers using a node.js server. Until here, everything is fine. But some ISP restrict the incoming requests from IPs ...
2
votes
0answers
224 views

scaffolding a multi-angular-app portal with usersystem

I'm trying to find the best way of developing a portal that a user can log in to and then be presented with a range of different apps (angular). They should share the same api-backend. I think that ...
1
vote
4answers
686 views

Call the database every time, or create an object in memory, and if so, how and how often to update?

I'm creating an app in javascript/nodejs and using neo4j as database. Let's say I have an entity User in my database. It has a bunch of properties, like boxes_collected and places_visited, which keep ...