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.
1
vote
0answers
4 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
12 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
...
-1
votes
0answers
17 views
Node.js, Angular 2, and PassportJS Seed Application [on hold]
I wrote a seed application to help developers get started using Node.js, Angular 2, Polymer web components, and PassportJS to form a basic OAuth user driven login site with Angular 2. The demo site ...
0
votes
0answers
23 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
27 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
13 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
0answers
26 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
23 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 ...
1
vote
0answers
24 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
21 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 ...
1
vote
0answers
20 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
45 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
70 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
53 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
48 views
Node: Routing through controller's file name
Before I started learning Node.js I was happy doing my projects with PHP codeigniter.
So when I learned Node.js, I tried to implement the routing mechanism codeigniter use by looking up controllers ...
2
votes
0answers
27 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 ...
0
votes
1answer
45 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
57 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
37 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 ...
0
votes
0answers
21 views
How to avoid callback hell in my node js code to make it faster and use the single thread modal to avoid blocking thread?
I am using MEAN stack to develop my application. My server has three clients app 1. iOS App 2. Android App and 3. Browser based App. All app is served from single server. I am facing problem when I ...
2
votes
0answers
44 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
41 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
35 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
22 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
49 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
59 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 ...
1
vote
1answer
42 views
Handle API Timeouts in Node Sails.js
I am working on a node.js sails.js app that handles a number of API calls and uses Bluebird for promises. The API calls have been reliable but I would like to build in handling for if they do not ...
1
vote
0answers
20 views
1
vote
1answer
49 views
Reading text from the web and writing to a JSON file
This code reads text from the web using a WebDriver element and writes data to a JSON file. I had to use if-...
2
votes
1answer
72 views
Probe for open application on a TCP port
I need to examine an application port to see if it opens and I need to put the retry count as a parameter. Since I'm new to Node I wanted to get your feedback on it
for improvements.
...
0
votes
0answers
19 views
0
votes
0answers
67 views
Npm-module: socket-event
I've written a small npm module. It is my first module. I'm asking you to review several things:
The code. I am rather starter, so any wise critic will be super.
Any suggestions or ideas on the ...
3
votes
1answer
28 views
Reading transactions from a file and writing them to a database table
I am learning Node.js and I would like to see if I'm using it correctly:
...
5
votes
1answer
56 views
VCF parser for eventual genomic data visualization
I've just started out writing an app that will visualize genomic data for anybody to understand.
When you get your genome sequenced the raw data usually comes in the form of a VCF file. I started out ...
1
vote
1answer
36 views
Simple POST function in ClojureScript and Node.js
Node's HTTP library provides a handy shorthand function for GET requests. Something similar doesn't exist for POST requests. I'm trying to write one in ClojureScript that compiles to node-readable ...
3
votes
1answer
46 views
Loading a database table using a promise chain
I am creating a util module that I'm using to communicate with a MS-SQL database. I want each public method to return a promise. I started with a private function that executes a DB query and returns ...
9
votes
1answer
89 views
Chat.SE in Terminal
This is a script that accesses the SE impromptu APIs to receive the fkey, a variable need for connection to chatrooms, and uses it to build a websockets connection ...
3
votes
0answers
26 views
Periodically monitor if record is not updated using Node, Event and setTimeOut
Here is my scenario:
Every user checks in every five minutes.
If some user doesn't check in after 5 minutes, I should be able to keep track of it.
If some user doesn't check in N number of times, an ...
3
votes
1answer
50 views
Nodejs Async get request
I made a small application that makes async calls to an api (local in this case). The target application will make a million of calls per day.
With maxSockets set to 1 I had a time of 45 seconds. ...
1
vote
1answer
63 views
Very basic isomorphic JavaScript application
I'm trying to update my skillset by learning how to write isomorphic JavaScript applications. For my stack, I've chosen React and Express - no database yet.
The problem many people seem to face when ...
6
votes
1answer
61 views
Baking homemade pies has made me so many new connections
Sorry, if you were looking for fresh baked pies, I only have a web client to help you sell them.
I've recently picked up server-side JavaScript and have added it to my toolbox, and while I've had a ...
1
vote
0answers
25 views
Properly updating multiple MongoDB documents with Angular
In the app I'm creating, when a user upvotes a post, the post should be upvoted, as well as the user that wrote the post. But this updates two MongoDB documents. This presents a number of issues. I'll ...
1
vote
0answers
37 views
Async process to send a contact email and confirmation message
Using nodemailer and node-email-templates to send a contact email and confirmation message. As is, I can catch any errors, but (if a file attachment is included), this process can take up to 30 secs ...
1
vote
2answers
60 views
Checking if an element exists in an array efficiently and return it
I am writing a function for my node/angular app that will prompt the user with a random question that he was not asked before.
To achieve this I wrote this function:
...
3
votes
0answers
37 views
Checking a user registration form before sending
I think this isn't right way. Maybe you can suggest something about error-displaying in error-container which fill in JS.
index.html
...
7
votes
1answer
36 views
Refactoring a phantom server called Swayzee
I have made a tool that is pretty useful for me. I have made it open source on github. It is a server that listens for requests and returns an HTML static version of a single page app. It works with a ...
6
votes
1answer
142 views
Sails.js controller method for an admin to update a user account
I am new to Sails.js, Node.js, and web application development in general. My current understanding is that well-written controllers should be "skinny" meaning they should be as simple as possible, ...
-4
votes
1answer
52 views
Create new object with properties of other two objects [closed]
I'm working with two huge objects: event and booking, and in my code I need to create a new object with just a few properties of both objects, which I am doing like this:
...