Node.js is an event based, asynchronous I/O framework that uses Google's V8 JavaScript engine. Node.js is commonly used for heavy client-server JavaScript applications.

learn more… | top users | synonyms (2)

4
votes
1answer
34 views

Generating Norwegian social security numbers

I have written some code in Node.js that takes a date as argument and return all the possible combination of social security numbers. I'd really appreciate some ...
2
votes
0answers
17 views

socket.io and garbage collection

I have developed a realtime text web app using socket.io that continuously displays text on the web page. When I run my code below with multiple clients connecting the memory usage for the V8 ...
0
votes
0answers
17 views

Function that creates an object graph from database rows

Using a low-level database driver called mysql, I run a query against the database: ...
2
votes
2answers
43 views
0
votes
1answer
12 views
1
vote
0answers
10 views

MongoDB Per-Module Reusable DB Object With Reconnection Handled

This implementation was derived from the following requirements. I would like to learn that whether the implementation is clean enough, without memory leak and performance hit. Requirements Always ...
0
votes
3answers
96 views

Multilingual greeter object

After coming across Douglas Crockford's views on class-free OOP, and doing away with new and this in Javascript I tried defining an object with its own variable and function, and returning it in JSON, ...
1
vote
1answer
27 views

Silly redis implementation

This is a silly Redis implementation that handles only three commands: INFO, ECHO, PING. The implementation is based on streams: ...
1
vote
1answer
27 views

Node module to fetch/post API data

I'm fairly new to JavaScript and Node and am wondering if I'm on the right track. Module file: ...
0
votes
0answers
9 views

Filter for user then grab object out of array

I have an Angular + socket.io app that sends a message to a specific user when a button is clicked. So I have a repeater of user in users then a ng-...
1
vote
0answers
99 views
2
votes
0answers
27 views

Node.JS HTTP shortcut wrapper

The Node.JS HTTP and HTTPS modules only provide .get shortcut function, unlike AngularJS's $http which provides them all. I went ...
1
vote
0answers
24 views

NodeJS Configuration Exporter

I have created a NodeJS script that I will be using to export front-end configuration details from my Zabbix installation, which will then be sent to my secondary (backup) Zabbix installation to keep ...
0
votes
2answers
16 views

Nested values copies from one object to another

Here is a nodejs code that copies values from one object (submitted from a firm) to a model object. Model: ...
1
vote
1answer
72 views

Unit tests for an Express middleware function that does basic authentication

I have written an Express middleware function called authenticateRequest that looks at the Authorization header of an incoming ...
11
votes
1answer
222 views

Make a summary from a larger text-file

This code makes summaries from larger texts. I have searched around for an algorithm and found the following: Associate words with their grammatical counterparts. (e.g. "city" and "cities") ...
2
votes
0answers
16 views

elastic search index/mapping creation

Including the full module, but the method I'm interested in is createIndex, feels more complicated than I think it should be. Still new at both node and elasticsearch ...
2
votes
1answer
33 views

NodeJS static file HTTP server

I wrote a NodeJS HTTP server specifically for serving static files. I didn't bother much about security since the server is going to be used locally in my Electron application. ...
2
votes
0answers
42 views

Signing timestamped API queries

The following code should prove to offer sufficient security for public API so my main concern is about design flaws in process. It is meant to describe the process and eventually get included in ...
2
votes
0answers
24 views

Nodejs-Compass,PID,Motors-with johnny-five

I just finish coding this code which use for control robot using compass sensor with PID control to control motors. Trying to make javascript object for necessary job. Please guide me for a better ...
4
votes
0answers
79 views

Restructure of Express CORS middleware for unit test

How should one break this component down to better perform unit test on its behaviors? Issues: Authentication middleware component makes external request. Must recognize preflight and final ...
0
votes
0answers
26 views

Simple channel broadcaster via NodeJS websockets

I have a system in PHP and I was asked to add some real time features. I was wanting to learn NodeJS so I considered a opportunity to kill two birds with one stone. But after some search I was unable ...
2
votes
0answers
35 views

Node my Chatter

In an effort to teach myself Node.JS and truly delve into its communication capabilities, I elected to recreate a previous chatting project. It took a bit of forethought to acclimate code to the ...
1
vote
0answers
29 views

Recursion into git diff tree using nodegit

I'm using nodegit to develop the backend for a nodejs app that uses a mix of mongodb and git for persistence. The app has to version documents and be able to present diffs between versions, thus the ...
6
votes
0answers
52 views

Node.js parallel file download, the ES6 way

I wrote a script that downloads all PDFs found on the web page of a particular government agency. I would have chosen bash for such a task, but I want the script to ...
0
votes
0answers
34 views

Web-scraping library

Here are two functions that make a request for a given URL and then takes the response body (HTML) and loads it into the cheerio library: scrapeListing.js ...
0
votes
0answers
42 views

Convert JSON into Avro acceptable format

I've written a node.js command line script that takes a multi-line file of JSON and a schema template of what the object should look like, and converts it to a format that Apache Avro accepts. ...
0
votes
1answer
40 views

Spawning child processes and event-listening

This function scrapes data from a webpage by spawning a process that executes a CasperJS web scraping script. The spawned process outputs data to stdout. This ...
0
votes
0answers
16 views

Alphanumerica binary search in node.js

I have some rather large arrays with hash values in them that looks like this: ZjFhOTZjYzgtMmZhMy00YjdkLThmMDgtNjI4MjYxNTc3MGRlXw==ntyxntmzmzkw I've done a binary search, using the node.js ...
1
vote
1answer
41 views

Iterations with asynchronous functions

I haven't really worked much with asynchronous code so I'm wondering if I am doing something wrong/something could go wrong. Right now of all the test cases that I have done, my code has worked but ...
1
vote
0answers
25 views

Producer/Consumer write to file

I'm concerned with the memory usage of this application. When I start it and look at it's memory usage while it's waiting for input, it's memory usage is around 13,212 K. When the application runs ...
2
votes
0answers
27 views

One class unit-tests

Its my first attempt to unit-test in Js. Not yet TDD. What I can change? EventsPersistancyService.js: ...
2
votes
1answer
22 views

Parallel computation to be merged, depending on single call

Steps: Get AMOUNT from a call to API endpoint /a, e.g. AMOUNT == 5 (in the code it is set ...
3
votes
1answer
40 views

Recursive function to copy over an object with very specific constraints

I totally suck at recursion. I have a function that works but it also looks horribly wrong. I would love to 1) Know how to write it properly 2) Know about resources to read/study so that I don't get ...
0
votes
1answer
61 views

Angular front end of chat web app

I'm using the MEAN stack to make a small chat app, which will soon support braided messaging. This is my first Angular app so I am not sure how I'm doing on the front end portion in terms of keeping ...
1
vote
1answer
186 views

Passing Node.js SQL connection to multiple routes

Here are the app.js, users.js and user.js routes of a node application I am building. As you can see I am connecting to the SQL DB in each route, and this is not ideal. I have tried passing the ...
3
votes
0answers
64 views

Keeping error details out of responses (Restify)

I'd like to make sure error details are never sent out in responses from my restify-powered API. The best way to achieve that seemed to be via wrapping server.formatters in another function which ...
0
votes
1answer
60 views

Routing through controller's file name

Before I started learning Node.js I was happy doing my projects with PHP codeigniter. When I learned Node.js, I tried to implement the routing mechanism codeigniter use by looking up controllers file ...
2
votes
0answers
34 views

Extracting data for a tag cloud using Lazy.js

I've just started using Lazy.js, which is my first exposure to a "functional style" javascript library. I'm still utterly lost as to which of the hundred different functional javascript libraries to ...
2
votes
1answer
53 views

Asynchronous database lookups in Node.JS using Promises

Not confident enough if this would be the correct 'node way' of writing Promises: Essentially, there are two async database calls, the result from both of these ...
2
votes
0answers
74 views

Managing modules in phone book app

This is a test app built with NodeJS, Express and MongoDB. This code is the main and complete JavaScript file. I would like suggestions on dividing it into different modules and making the main app.js ...
0
votes
0answers
52 views

NodeJS link shortener

I made an app in NodeJS, with Express and Mongoose, that takes a URL as input into the address bar, and returns an alias to that URL. It can be used as a link shortener. The app is intended to ...
2
votes
0answers
47 views

Knowledge base app using MEAN stack

I've been working on an app based on the MEAN Framework. I have got the app working but I just wasnt sure whether my coding structure and standard was good enough, meaning does it adhere to the ...
1
vote
0answers
16 views

Updating Angular JS Model [closed]

I am trying to write a basic wiki/item list that pulls data from an external API (one I set up for testing), lets you add a new item which then updates the model accordingly and posts it back to the ...
0
votes
0answers
98 views

Bluebird promises: generalized retry logic with timeout

I'm attempting to write an idiomatic utility that uses bluebird promises to retry asynchronous logic until it is successful, or until a set timeout expires. Currently I'm looking at: ...
0
votes
0answers
21 views

Get top of request given the file exists in Node.js application

The user can specify which source to get the list, if the file is not found then Boom returns 404. After that, the found source will fetch the top list and append ...
1
vote
0answers
38 views

Reading content of directory for each HTTP request

I have a piece of code written in node and I wanted to know if I am in the right direction. Basically I have a site where the homepage lists 6 vehicle cards. Every time the page is requested I do the ...
0
votes
0answers
27 views

Async boolean expression evaluator in ES6

This is a pretty simple Node package designed to accept a "boolean expression" and evaluate it asynchronously. The full project is on GitHub. Essentially, an expression like ...
2
votes
1answer
83 views

Updating HTML table (Userlist) with Node.js

I currently have an HTML <Table> with all the socket.io-rooms. Client-side, the table gets fetched if you visit the page. If some room gets created or ...
0
votes
0answers
74 views

Calculator in Node.JS

I'm new to parsing, and there's only one way to learn anything, and that's to do it yourself. So I did. I wrote what is essentially a calculator. But instead you will send it a string and it will be ...