I'm able to successfully make a request to the Twitter API using a REST client with the following options: https://api.twitter.com/1.1/users/show.json?screen_name=chrisryanphd Host: api.twitter.com User-Agent: myApp Authorization: Bearer ******** Accept-Encoding: gzip However, when I try to d...
I am building a REST api using Restify in Node.js and I was running in a trivial issue that I have defined a couple of global variables within the Node module (which are not global but confined to the modules scope if I am not mistaken). However, in some of the REST Endpoint handlers I populate ...
I have a really strange situtation; my schema has a fieldname which is called "type" type: { type: String, default:"cow" } the schema is extended by subclasses which override the type field name to change the default value when I create the document and directly after the cb fires, find it an...
I got IP address of client with this function: function getClientIp(req) { var ipAddress; // The request may be forwarded from local web server. var forwardedIpsStr = req.header('x-forwarded-for'); if (forwardedIpsStr) { // 'x-forwarded-for' header may return multiple IP...
Im just getting started with Mocha, testing against a very basic Express 4.0 rest API. describe('API CALL UNIT TESTING', function(){ var app = require('../../app'); before(function(){ app.listen(3000); }); describe('GET', function(){ it('respond with json', func...
Trying to be able to run a SSL server using the generator-angular-fullstack https://github.com/DaftMonk/generator-angular-fullstack. However when I look at all the examples for enabling SSL, when I comb through the code it doesn't seem to initialize the server the same way as the NodeJS document...
I have a schema like so: var personSchema = mongoose.Schema({ minders: { type: [minderSchema], required: false } } var minderSchema = mongoose.Schema({ display_name: { type: String, required: true }, minder: { type: mongoose.Schema.Types.ObjectId, ref: 'Person', required: true } }) I wo...
I'm setting up a server that communicates with raw TCP using the 'net' module. I noticed something very strange: the data has a toArrayBuffer method, but it returns something that isn't an ArrayBuffer net.createServer( function(socket) { socket.on('data', function(data) { var ab = da...
Is there a way to unset environment variables with grunt-env? I know I can set them from the module, and there is even a way to set them to a value only if it doesn't exist. However, the project's GitHub page does not seem to show how to unset them. Any solution would be better if it also include...
Node has a "cluster" module, using which one can create a parent process that forks worker children. The worker children all listen on the same socket, thus load balancing between them (and thus between CPU's) happens at the kernel. Such a process would also have to monitor for children dying an...
I want to promisify node-postgres' pg.connect method along with the inner connection.query method provided in the callback. I can .promisify the latter, but I need to implement the first one manually (if I'm missing something here, please explain). The thing is, I'm not sure when to use .defer ...
Well , I want to create highly scalable web server , having millions of concurrent connections , I know node and go both have capabilities , but which is batter doing at low resources ? I have tried with node , but I am curious about go lang as its Google product. so please let me know why should...
I have a development server working on 192.168.1.22 and i want to run node.js on it but it gives some error. I want to only test some cases but even can't run it. After i run it i will fetch my onclick button and from node.js sent that post to my php file. and return data from php to node.js and ...
I have this field which is working as I want tagSlug: { type: String, label: "slug", optional:true, autoValue: function() { if (this.siblingField('tag').isSet) { return URLify2(this.siblingField('tag').value); } } } But I also want to make another fiel...
I am sorry if this question has been asked before in the forum but I am not able to find what I am looking for. I am looking to develop a notification mechanism in my sails js app. Taking the analogy of facebook, lets say we have users and pages. Users can follow other users Users can like a ...
I need to open multiple windows/tabs of firefox using Node. Now, when i use a spawn() call: var spawn = require('child_process').spawn; ff = spawn('firefox', ['www.stackoverflow.com', '-new-tab']); If i use two (or more) calls right after the other, firefox claims there's a page that is not re...
I am executing the code in Github for Authorization Code Flow using simple-oauth2 npm. In this code, I can see two flows are there. One to generate the Authorization code and other flow to get the access token. I want to omit the first flow in the mentioned code. I want the code to be something l...
I'm trying to call a function by a number read from the command line. This is my code: saveuser = function(user, callback) { //.. }; removeuser = function() { //.. }; finduser = function() { //.. }; updateuser = function() { //.. } var options = { 1: { op...
I'm trying to get a file from S3, and store it in NOSQL couchbase. I'm trying to store the outputStream, with the following code: var outputStream1 = fs.createWriteStream("./tmp/" + url); // if statusCode == 200, then we have the file, lets save it in out cache and then send it ...
I'm using the archiver module ( https://github.com/ctalkington/node-archiver ) to create an archive from a directory but I've got a problem; It doesn't store images despite, I guess, I'm targeting the whole directory. The function relative to this step is: var output = fs.createWriteStream(file...
I'm using https://github.com/panique/php-login-advanced login script, also there is a NodeJS server which authenticates users by their session cookies. The problem is when the user resets his password, he's still able to authenticate with his old session cookie. My goal is to remove all cookies f...
I am trying to keep a version of git of all the components inside node_modules. I just removed from .gitignore the node_modules folder, I was expecting to sync without any trouble until I get that : The file will have its original line endings in your working directory. warning: LF will be repla...
I am trying to implement sticky sessions with HAProxy. I have a HAProxy instance that routes to two different Node.js servers, each running socket.io. I am connecting to these socket servers (via the HAProxy server) using an iOS app (https://github.com/pkyeck/socket.IO-objc). Unlike when using ...
I have created a linux virtual machine (from bitnami MEAN 2.6 image) in Azure. I have added following as an end-point: Name Protocol Public Port node TCP 3000 But when I run sample node application (on port 3000), I am not able to access http://mydomain.cloudapp.net from ou...
I have built a custom yeoman generator. You can find the code at https://github.com/abhishekoza/generator-ratchet. When I try "npm test", I get following error 1 passing (454ms) 1 failing 1) ratchet generator creates expected files: Uncaught Error: You don't seem to have a generator ...
Is it possible to build a node.js application, and run/host it on an intern local server of a company (Windows or Linux) ? So just on a normal server where beside of other programs, a lot of data is been saved.
I'm a developer at enterprise social network product, and I'm working on a feature that is very similar to Facebook notifications. We want to provide a notifications mechanism for our customers in real time. I'm building a notifications service in node.js that my system can interact with and...
i need to play sound on the raspberry pi with a node.js script. Everything is fine when i'm starting the script from the commandline myself. When i run the same script after startup out of the /etc/rc.local script i see my running process when doing "ps aux" but i cant hear any sound. I also trie...
I've written a simple node program to parse an excel formatted HTML table returned from a corporate ERP, pull out the data, and save it as JSON. This uses FS to open the file and Cheerio to extract the data. The program works fine for small files (<10MB) but takes many minutes for large files (...
Async and callbacks are still concepts I struggle with. I have been reading and trying to make sense of code that uses them to gain more familiarity. I don't understand why this snippet of code uses a callback instead of just passing in a value (instead of an anonymous function with the argument ...
I'm wonder if minifying my server-side JavaScript files is good for my NodeJS app performance? I'm doing it all the time for the client-side JS + CSS files but i curious if doing it for the files the NodeJS app running is necessary? Thanks.
Main application server runs with heavy php application. I wants to know is there any server load will happen because of node server running in main application server or is it better connecting socket to another server which is used for running node ?
I'm trying to have this setup : root is a folder corresponding to a git project root/projectA is a node module root/projectB is a node module, that needs to require projectA. Some very important constraints : I don't want to publish any of those node projects to npm I can not have a differ...
In my server.js I have: app.all("*", function(req, res, next) { // only gets called when I'm doing a post/get request next(); }); But I'd like to get an event when a static file, such as an html file was accessed on my server?
I am trying to install Karma. However, after following the installation instructions I the terminal still says -bash: karma: command not found I attached the terminal in- and outputs below. What am I doing wrong? Patricks-MacBook-Pro:~ patrickreck$ sudo npm install -g karma npm http GET https:...
I am trying to determine why my nodejs server has extremely high CPU usage. When running top, I can see that the CPU usage for node can hit up to 60% with a single user. I used node-tick to profile my application, but I cannot seem to understand the results well enough to find the source of the p...
Currently in my Node.Js app I use node-uuid module for giving unique IDs to my database objects. Using uuid.v1() function from that module I get something like 81a0b3d0-e4d0-11e3-ac56-73f5c88681be Now, my requests are quite long, sometimes hundreds of nodes and edges in one query. So you can...
I'm working on a streaming audio server but I'm having trouble playing multiple files after each other (like a playlist). I'm using Binary.js on top of Node.js to stream chunks of mp3 files. Problem is, when trying to play the next file decodeAudioData doesn't work. It stops at the end of the fir...
I have a set up with a GET and a POST route, the idea being that POSTing to the route triggers an event, and the GET route is a server-sent eventstream which fires each time the POSTed event is triggered... however, i think i've done something wrong as event listeners seem to get added routinely ...
I'm running an aggregation on a collection of around 300k+ records which requires several unwinds and regroups. I'm hitting the following error; 'exception: Exceeded memory limit for $group, but didn\'t allow external sort. Pass allowDiskUse:true to opt in.' I can't seem to work out how to pas...
I'm trying to play a video file in a loop using omxplayer on a Raspberry Pi. I found a module called omxdirector for NodeJS that works really well, but unfortunately, with the native omxplayer, when you play a video in a loop there's a 2 second delay where the user/audience can see the terminal ...
So, I'm completely new to mocha, and promises and I was asked to write integration tests, which posts form data to a page, gets an authentication key, and then run tests on the key. I'm getting the key back properly, which is confirmed by my log statement, but when I run mocha, my test says 0 pa...
I have a function inside of which there is a nested callback function structure. I want that first "mother" function to return a certain value, after it's been calculated in the callback functions sequence. However. it doesn't really work. Here's a simplified version of the code, do you think you...
hey guys im new with express and handlebars, i wanted to use handlebars as a template engine on my express.js app but then i keep on receiving this kind of error: which was get generated by this code var express = require('express'); var path = require('path'); var favicon = require('static-fa...
I'm building a node app which uses passport and passport-twitter to allow users to login. Whilst I'm developing the site however I want to password protect the whole thing like using .htpasswd on an Apache server. I've setup http-auth in addition to passport in an attempt to achieve this but it ...
I've got a VS2013 solution with a mix of NodeJS (using TypeScript) and C# class library projects (they're bound together by EdgeJS). Where the NodeJS projects are concerned, one can be considered a library (for a RabbitMQ bus implementation), two are applications which are meant to be hosted as ...
I want to write a single codebase plugin that works with both Node.js and browser. I am writing the base code in Node.js and then converting it to have support for browser version using the node module browserify. All my GET and POST requests works fine when I execute the code in Node.js. If I wr...
I have html page: <!DOCTYPE html> <html> <head> <title>Test</title> <script type="text/javascript"> function pushMe(elem) { var request = new XMLHttpRequest(); if (!request) alert("Error initializing XMLHttpRequest!"); ...
Sails 0.10.0-rc7 Using sails built in blueprints I am attempting to get information from my server using this functionality. (Im looking to user the default behaviour) Client //Client on different server (localhost:8000) //Sails server var socket = io.connect('http://localhost:1337'); socket...
In a file called data.js, I have a big object array: var arr = [ {prop1: value, prop2: value},...] I'd like to use this array into my Node.js app, but code like require('./data.js') doesn't help. I know how to export functions, but I'm lost when it comes to "importing" arrays. How do I add ...
I need to be able to read the Content-Length header of requests before they are actually processed. My exact problem currently is that I have a mobile application, pushed to many users, who send data every 30 seconds. If the data push didn't work (no internet, for instance) or the server doesn'...
I am trying to change the value of a variable in the callback function. db.collection("some_collection").find().toArray(function(err, arrayResult){ var myArrayResult = arrayResult; some_asynchronous_call(param1, param2, successCallback, failureCallback); function successCallback() { ...
I am creating an AI competition where competitors can upload their AIs (node servers) to our node server and we take in their code and run it in an automated fashion. On first code upload, I use child_process.spawn() to run node server.js xxx where xxx is their port. I store the spawned child as...
I'm trying to deploy a MEAN stack app to Heroku and am running into trouble when it tries to find 'gruntfile.js.' The relevant logs follow: Caching node_modules directory for future builds Cleaning up node-gyp and npm artifacts No Procfile found; Adding npm start to new Procfile Building runtime...
I am new to node and new to sails. So this question may be pretty stupid, but I have used the "sails generate prospects" command to generate a REST api. I can access that api by visiting /api/v1/prospects (i set up the prefix). I used chrome's postman extension to POST the following json array t...
For reference you can check the issue I submitted on GitHub. I am able to stream to MongoDB and the file is persisted and accessible, but the README shows during the parsing you can access the file id. This is required if you want to log or enqueue background jobs for the file. I am unable to log...
I'm trying to insert data to a hasAndBelongsToMany relationship with JugglingDB, so I'm doing like this: ModelA.hasAndBelongsToMany('ModelB'); ModelB.hasAndBelongsToMany('ModelA'); var modelA = new ModelA({ attr: data }); modelA.save(function(err) { if(!err) { var dataB = { attr: data ...
I am working on using Azure to maintain a web application that will allow me to store information into a storage system through a web interface. I would then like to query the information from that storage system using a client application. I noticed that there are a variety of technologies that ...
I Googled this and all that came up was how to serve static files. I couldn't find what serving meant or what static files were. Could someone write a detailed explanation of this. I'm a bit new so try not to use very technical terms. I don't really know what to tag this with so feel free t...
I’m building a node.js app that fetches geolocated photos from the 500px API based off a location search. The API request requires the page of results you want back. Say for example I search for London for the first time, I’ll request page=1. If I search for it again, I’ll need to search for pag...
Trying to use a function in app, that can be called in actions. Put in app.locals doesn't work : app.locals({ "form_tag" : helpers.form_tag, "text_field_tag":helpers.text_field_tag, sendHttpGs: function(req,res) { ...
Hi I have an expressJS(Client) app which uses another node.js(Server) app as the server. The node.js app exposes URL through which my expressJS app does CRUD operations. It was a design decision to have two different node servers(one for client, one for server). Nodejs(Server) app has mongodb as ...
I'm new to NodeJS and I want to implement kind of push notification using web socket. But I want to do it using a modular approach. The system that will detect data change will probably be a database using kind of trigger or it could also be a service pooling the database to detect changes (colum...
In the node shell I see this: > console.log(JSON.stringify(Q.fcall(function() { return 10 }))); {} undefined HOwever the docs for q here :Q say that it returns a promise, which is an object with an apply() and a then() function. So why is this returning an empty object??
Using pip one can do: pip freeze > requirements.txt This extracts all dependencies. Is there something similar for npm?
Does Meteor framework support any conflict resolution? Any techniques or guidelines how to tackle storage of data while Offline in Meteor / Phonegap app? Is it possible with Meteor framework to work offline and then re-sync correctly?
I'm trying to render dynamic content between my static navbar and footer upon clicking the links in my navbar, but every time I click a link it duplicates the content including the navbar and footer. I'm using node with express and the jade template engine. This is my (simplified) top-most jad...
I have a function inside of which there is a nested callback function structure. I want that first "mother" function to return a certain value, after it's been calculated in the callback functions sequence. However. it doesn't really work. Here's a simplified version of the code, do you think you...
Please tell me what are the orm for node js, supporting custom types and custom query. For database postgresql, sqlite? I looked at the Sequelize, node-orm2, camintejs and they are not suitable.
I have a huge dataset that increases by hundreds/thousands items for sale every few minutes. I will be parsing this data as it comes in and I'm looking for suggestions on how to efficiently match new incoming items with users who want the item. Examples of how other have done this would mean th...
I’m using Mongoose.js to interface with my Mongo database. This function searches through my Location names and should be logging not found to the console instead of found, as I don't have a Location with the name !@£. Location.find({name: "!@£"}, function(err, obj) { console.log(obj); if (!...
In express.js i am trying to add a router for url /xxx/xxx/items[5] . the url have Square Bracket. Router works fine without Square Bracket, but fails with Square Bracket. Have any one faced this before if so, what is the way to make it work.
I would like to cache resources in my MEAN-stack application. I am trying to use $cacheFactory but it doesnt work. Here is how my app retrive the data: controller <- service <- mongoose So I want the cache to be in the service and to be cached for all users (the app calls the database once, the...
« first day (10 days earlier) ← previous day next day → last day (67 days later) »