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)

1
vote
1answer
24 views

Node.JS Twitter Count Module

I would like someone review this code and tell if it can be done better, or if the code is elegant and simple enough for the task at hand. I used code climate and I got 4/4 and my test coverage is ...
3
votes
0answers
17 views

RSS parser for Node.JS

I would like someone review this code and tell if it can be done better, or if the code is elegant and simple enough for the task at hand. I used code climate and I got 4/4 and my test coverage is ...
1
vote
0answers
12 views

Semaphore with Node and Redis

I'm learning Node and Redis and created a semaphore for master/slaves. ...
1
vote
0answers
14 views

Node.js Paging with Mongodb

I want to create variable paging on Node.js with MongoDB. I use Mongojs. On client side create a request ...
0
votes
0answers
16 views

Sharing app methods to routes in Expressjs 4

I would like to know the right way to execute an action(a method) from my app into my routes. I have to do this because I have a POST route waiting to be call from other pages (like an API call) but ...
1
vote
0answers
21 views

Appropriate use of bind for elasticsearch callback

I'm starting a new project with Node. I'm learning the object model, and the code below is my first module. One of the things threw me was the behavior of this ...
3
votes
0answers
58 views

JavaScript 8-bit floating point

To start, I am in the wrong language and I think it is time learn some C++ and compile it as an add-on for NodeJS. For now, though, I have a few code snippets that work that may be interesting or may ...
0
votes
0answers
14 views

Middleware code for preventing repetitive identical requests in Express

I have problems when some of my users starts to frenzy click the save button generating duplicate records on the database. I wanted to create a generic solution so I could reuse it on another projects ...
3
votes
2answers
100 views

Generate URLs from a complex JSON object using recursion

My task is here as follows : Input : A complex/nested JSON object with nested arrays as well objects Output : A JSON object that contains a set of URLs with their titles: ( key,value ) ...
2
votes
0answers
37 views

Exiting a Promise early

I'm using a Promise chain to write some data to a file, execute a command on it, inspect its results, and send the results, using Express.js. The thing about my function is that I need to be able to ...
0
votes
0answers
11 views

Node.js - Asynchronous JSON query (probably easy fix) [migrated]

I apologize if this is a stupid question, but I am new to Javascript and Node.js really hurts my head because it is asynchronous. My goal is to query for a JSON object from an API and be able to work ...
-2
votes
0answers
34 views

Performing some database checks before saving data [closed]

My question is because I believe that maybe there is a better way to design my code when I need to do sync tasks in JS and wait for the response. I'm working on Node and I need to save some data (I ...
3
votes
0answers
26 views

Q.js worker pool

I'm building a program to scrape data about hockey games in order to compile statistics. One of the run modes will process all of the games in a single season (1230). Processing a single game consists ...
0
votes
0answers
14 views

Save file from request to database

I am saving (image) files to PostgreSQL database in my Node.js and Express server application. The code is used to upload user images to server (at the moment it is not restricted to image files in ...
3
votes
0answers
61 views

Personal Website

I have written the following code for my personal website, in Jade and Stylus. Can anyone review this code? Are there any tips that you can give me on how to make it better? Here is the main-page.jade ...
4
votes
1answer
56 views

Continuable if error is null

I made a method that I can use to avoid having to handle errors from callbacks. What it does is, call the passed method only if the first argument is null. So essentially it will bypass to the last ...
1
vote
0answers
25 views

Built a database layer for an online / offline Crypto Currency Wallet: Browser Storage

This is largely self contained, iirc the only dependencies are: Bitcore bower install bitcore PouchDb ...
0
votes
0answers
32 views

Parsing sentences to create a chat bot

I am developing a chat bot with Node.Js. I am trying to find efficient way to parsing sentence. ...
3
votes
2answers
82 views

Check if variable is sent

I have this piece of code in my Node.js API and I feel like it could (should) be optimized. ...
1
vote
0answers
15 views

Sourcemap translator service

This is my first attempt to a serious Node.js application, I've tried to follow the async style of Node at my best, but I have several doubts and I am sure that this code can be massively improved. ...
2
votes
1answer
41 views

Database module for node.js

This will get quite clumsy if I continue down the road with this design, so I'm asking you, enlightened ones, is there a way to make this prettier and easier to understand? Primarily the ...
2
votes
1answer
52 views

Parameterized route

Is this approach considered good practice, or should I create separate router.delete functions for all my routes? Please, explain why. ...
1
vote
0answers
27 views

Monitoring a few servers / API endpoints

I am trying to create a simple NodeJS program that monitors few provided servers or machines and provides output in JSON. ...
1
vote
0answers
78 views

Payment Gateway - single payment with credit card (handling path & choosing gateway)

This was an assignment and I am new to Node.js. You can find the complete project here. The code worked fine but was rejected, and wasn't given any reason even after asked. Statement: Create a ...
1
vote
0answers
24 views

NodeJS socket for handling errors

It's the first time managing Mongoose by socket.io and I'm wondering if this could be a good way: ...
1
vote
0answers
55 views

NodeJS authentication function rewrite with promises

I will post both of the modules, some of the code in them may be "irrelevant" for the main concern here, which is Security.prototype.authenticate(). Nevertheless, comments are welcome about all of the ...
1
vote
1answer
100 views

Consuming an API with authentication

I have created a library which consumes the Imgur API. This is the main file. ...
1
vote
1answer
61 views

Handling callbacks when doing async programming and dealing with scope

I'm using HapiJS to create a little backend for my side-project. In grabbing RSS feeds, I want to loop through my list of website URLs, grab the correct RSS links in the ...
5
votes
2answers
62 views

Command line utility to output modified Markdown

What this command line utility does is to take a text file and update the content a bit before turning it into Markdown. For example, the first for loop searches all the straight quotes and replace ...
-2
votes
1answer
140 views

Multiplayer Tic Tac Toe with Socket.io [closed]

I am trying to learn Socket.io and develop a multiplayer tic tac toe game. Right now, I have developed a game that plays well when hosted locally, but I cannot seem to transmit game moves between the ...
2
votes
2answers
84 views

SQL Server to MongoDB Template

Looking for feedback on a set of templates I've just created. I'm planning on converting them to Yeoman but want to make sure they're ready for prime time before doing so. They are currently in ...
4
votes
1answer
71 views

Creating an async consumable object in Node

Background I have a situation where I have fixed number of objects with their own routines that would need to be called with the same initial message. To accomplish this, I have a Factory that ...
1
vote
0answers
18 views

Input a web page with poker events, output a gcal compatible CSV file

This script takes input from poker tournament pages at pokeratlas dot com, and outputs a CSV file that I can import to Google Calendar, listing each of the tournament events, start time, location, and ...
1
vote
0answers
12 views

Extend a rethinkdb query, with `if`s

I have something roughly like this: ...
1
vote
0answers
38 views

Sign-up controller and service

I'm programing server side node for a huge project. And I'm thinking my brains out about the best programming pattern that will be suitable for fast modification and changes. Tell me what you think ...
2
votes
0answers
41 views

Rewriting authentication controller using promises

I am in the process of refactoring some complex code that uses callbacks to instead use promises. I am trying to figure out if my proposed approaches make sense. ...
4
votes
0answers
113 views

Minimax for Tic-Tac-Toe

I have written AI for Tic-Tac-Toe using Negamax in JavaScript. The Negamax object is translated from an implementation written in Python. The code runs on a Node.js server and the player interacts ...
-1
votes
1answer
36 views

Mixing assignment and expressions- good or bad? [closed]

As far as mixing assignment and expressions.... is it better to do or not to do? For cleaner code and readability. mixing: ...
2
votes
0answers
62 views

To-do app in node.js

I get the feeling this code for a to-do app is not secure, and as I am just a beginner, I don't know about my coding style, is it conventional/elegant? Please don't hesitate to criticize me. ...
0
votes
2answers
69 views

Booking program

what could I do to make this code more beautiful? ...
2
votes
1answer
61 views

Conditional callback for asynchronous file copy

I'm trying to figure out the most elegant solution to do the following asynchronously using JavaScript (specifically node): Given a destination file name, check if it is a directory If it is a ...
1
vote
0answers
90 views

Pagination handlebars helper

I've build a handlebars helper that takes n total pages and currentPage and returns the HTML for the page number links, skipping ...
0
votes
0answers
16 views

Organization options email to send email with sendgrid

I am working in this controller: ...
3
votes
0answers
36 views

Optimization for better response time to use in analytics application

We are trying to use NodeJS for analytics. The following code gets the parameter from a URL and dumps it into a flat file. Is there any way to optimize it to get better response time? ...
1
vote
0answers
29 views
1
vote
2answers
45 views

Handling with the 'error' parameter inside a callback function in node.js

I have multiple controllers and every controller has this error handler: if (error) { res.render('error', { error: error }); } Sometimes I have more ...
0
votes
1answer
35 views

Using app.use only in routes that start with /admin

I have several routes, and I need Facebook authentication only in the routes that start with /admin: ...
1
vote
0answers
17 views

Code enhancement for existing npm package

I am trying to improve the code in the npm package. I have looked through the code but don't have any ideas how to write proper code. GitHub ...
5
votes
3answers
104 views

Concise HTTP server

Here's my code for a consise node.js HTTP server. It does work as intended, but I'd like to ask if there's any glitch or to be improved. ...