« first day (14 days earlier)      last day (63 days later) » 

2:22 AM
0
Q: Node session cookie that expires

user3693294Is it possible to create a session cookie (one that is automatically deleted when the browser closes) AND also has an expiration so that it will expire after a set time, let's say 15 minutes unless the user continues using the site? If they use the site, i'd like to reset the expiration so it las...

 
2:36 AM
0
Q: passport js req.user not available after req.login

ewizardI am trying to setup my passport sessions correctly. I have gotten to the point where, after a user signs up - I execute req.login() and then I have a console message, console.log(req.user). It returns: { email: 'xxxx', password: 'xxxx', id: 0 } So it seems as if, right after the user is create...

 
2:50 AM
0
Q: nodejs express middleware function return value

user3658423Im using node.js and express, I have the following route and the middleware function isMobile. If I dont use return next(); in the isMobile function, the app gets stuck because nodejs does not move over to the next function. But I need the isMobile function to return a value so I can process ac...

 
3:15 AM
0
Q: What is required to run a clone mean.js project locally?

user1476849A team member of mine put a meanJS project that a on GitHub, but when I clone it, it doesn't work to run with grunt through my local repository (it seems to be OK from the terminal) but when I open in chrome (localhost:3000) the page is blank. I am new to working with generators and what needs...

0
Q: How do I remedy "Error: Cannot find module 'child-process-close'"?

Tyler SloanI was going about business as usual and about to checkout generator-angular-fullstack. I got no red errors but a message a the end saying Error: Cannot find module 'child-process-close'. I tried many a-thing–uninstalling node, reinstalling, manually getting rid of files and directories in local ...

 
3:32 AM
0
Q: pack nodejs app without GUI

arachideI have develop an app bases on nodejs. It is a command line app without gui Can this be packed to binary execute file using node-webkit? Your comment welcome

 
4:21 AM
0
Q: socket.io doesn't seem to be starting and doesn't recognize io.configure method

ewizardI am trying to get socket.io running with node/express (I have done this countless times - so I am pretty baffled). When I try to configure socket.io with the io.configure method I get an error: io.configure(function() { ^ TypeError: Object #<Server> has no method 'configure' at Object.<a...

 
4:54 AM
0
Q: Nedb Multiple Collection Single Datastore

DBoonzI am a new to nedb. Its a kinda what sqlite is for sql community but for the node.js community. [https://github.com/louischatriot/nedb] I wanted to ask is possible to have multiple collections in a single database file (datastore). If there is, could please show me some code sample on how to go ...

0
Q: Getting ECONNREFUSED for json requests

SankaDI have an express(node.js) HTTPS server which works well with url-encoded type requests. But when I try to send a json post request it gives an error as { [Error: connect ECONNREFUSED] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect' } What could be the reason? ...

 
 
2 hours later…
6:52 AM
0
Q: Serve static gzip files using node.js

pj_automataI don't want to use a library which gzips on the fly, because of the overhead. I have some static js and css files as well as their gzipped counterparts. I want to serve the gzipped version only to browsers which support it. I considered using the static middleware in express to serve the stati...

 
7:05 AM
0
Q: passportjs idle/inactivity timeout

user3658423I am using passport.js for node.js/expressjs. Its very good authentication module. Does anyone know if its possible to implement inactivity or idle timeout? I already have a client side js that monitors idle time and logs out the user after 15 mins of inactivity. But lets say the user closed the...

 
7:55 AM
0
Q: node file system access error on heroku

user2990593I have a simple code that saves the image selected to the file system using express fs exports.upload = function(req, res) { var photoInfo = req.body, file = req.files.file, fileType = file.type.slice(6); //attaching the fileType to photoInfo because fileType is part of ...

 
8:14 AM
0
Q: Finding absolute url of img tag

ZedI'm using Node.js and cheerio for web scraping and currently have a situation where I can't extract absolute url of img tag. So here's the code: $('.images').each(function () { console.log("absolute url: " , $(this)[0].src) }); I'm getting back undefined for the sr...

 
 
1 hour later…
9:15 AM
0
Q: Add source maps to grunt workflow

dagda1I have a grunt talk like this that is my build workflow: grunt.task.registerTask("export", ["transpile", "concat_sourcemap:app", "browser:dist"]); I am transpiing es6 modules, then I have a concat_souremap task that looks like this: module.exports = { app: { src: [ "bower_componen...

 
10:11 AM
0
Q: Auto generate field with a certain format

AnupI want to generate a User Record Number automatically. When a new user is added, they get assigned a User Record Number. The User Record Number follows this format: “US-000000”. The first user added to a account will be User Record Number US-000001. How to do this? Is there any way in mongodb to...

 
10:28 AM
0
Q: modify password with expressjs mongoose passport-local

tibalteFirst of all, I'm french, and my english is not really good, I do my best :) I created a local authentification using PassportJs, Mongoose and Expressjs (v3.x). It works perfectly. When the user is logged, in the /account/ space, I created a form to change the current password (3 input : pass, n...

0
Q: JavaScript Requires and Exports in Node.JS

SiddharthI am writing a Node.JS REST API using Express, and I was a little confused about the require() and exports statements in Node.JS. For instance, let's say I am writing a simple app wherein app.js contains the basic app.get statements, routes.js contains the functions passed as a callback to those...

0
Q: Unwrapping objects members with V8/Node.JS

aseureI'm learning V8/Node.JS through one of my project and I'm wondering if there is a way to unwrap a C++ object inherited from node::OjectWrap (from the Node.JS API) and its members at the same time. All examples I can found have int members for instance and any of them try to wrap C++ object membe...

 
11:06 AM
0
Q: Failed to install socket.io?

blazonixMy installation of socket.io failed (as per this tutorial: http://socket.io/get-started/chat/). I installed this in the same root directory as index.html. After running this, though, there was node_modules --> socket.io (and the respective files) under this. However, the reason I said this w...

 
11:28 AM
0
Q: RangeError - Maximum call stack size exceeded

AnupI am trying to use findAndModify in Node.js. The query works perfectly in the MongoDB GUI, but in Node.js it gives me following error: RangeError: Maximum call stack size exceeded Server side controller User.findAndModify({ update: { $inc: { 'incr': 1 } }, upsert: true }...

 
11:50 AM
0
Q: npm install less throws error from ruby

Connor LeechI am trying to use the less, following their getting started guide I successfully ran sudo npm install -g less that ended with: /usr/bin/lessc -> /usr/lib/node_modules/less/bin/lessc less@1.7.0 /usr/lib/node_modules/less ├── mime@1.2.11 ├── mkdirp@0.3.5 ├── source-map@0.1.33 (amdefine@0.1.0) ...

 
12:39 PM
0
Q: Proper way of using mongodb connection or express.js across multiple node.js file

Mark ThienI want to split my node.js file into multiple file like user.js is for dealing with user database CRUD and group.js is for dealing with group database CRUD, database.js for initialising database and restful.js for initilising express.js. What my concern is whether this is a common or good pract...

 
12:50 PM
0
Q: MongoDB find document if exist - update else - insert

user3386802I have some troubles with mongodb. my code: for(var j = 0; j < arrayOfWords.length; ++j) { var word = arrayOfWords[j]; (function(word) { if (word.length > 2) { async.waterfall([ function(callback) { ...

 
1:07 PM
0
Q: Installing a PhoneGap plugin: BarcodeScanner

Joel MurphyI want to install the BarcodeScanner plugin in a PhoneGap project. I've read the Readme within the repository and it says that it must be installed with PlugMan like so: Install a plugin ---------------- $ plugman install --platform <platform> --project <directory> --plugin <plugin> [--vari...

0
Q: node.js write filestream disordered in p2p file download

Lihang Liguys. I try to use node.js to create a p2p file sharing application. While downloading a file, it will download the file block by block. The block size used in the following code is 1KB. But it has a problem, when available sockets number MAX_SOCKET_CNT is set to 30, it will not work. How to ru...

 
1:36 PM
0
Q: Nodejs fork multiple child processes, channel closed

artworkad シI start child processes in a loop and push them on an array to access them later. for (var i = 0; i < processes.length; i++) { var child = require('child_process').fork(process.env.PWD + '/worker.js'); child.send('doSomething'); child.on('message', function(message){ doS...

 
1:47 PM
0
Q: Node.js Forver keeps stopping other services running on the same box

James RobinsonI am using Node.js forever to run a web service and a website on my machine. These services are in files called app.js and site.js respectively I run multiple environments on the same box and have been having a devil of a time keeping the production or development instances up as every time I s...

0
Q: javascript constructor + node js createServer

Tal LeviIm trying to wrap node js server in JS object, In order to do that, I wrote this constructor: function staticServerObj (rootFolder) { this.rootFolder = rootFolder; this.port = null; this.isStarted = false; this.startedData = null; this.numOfCurrentRequests = 0; this.numO...

 
Hey, anyone familiar with forking child processes? I try to send a message to a process and I get "Error: channel closed"...
 
2:40 PM
0
Q: How to add/subtract with Mongoose-long?

user1502301I am trying to use mongoose-long for large numbers. I'm not sure I am using it correctly. I set the value... user = new User({val:12345678901234}); val is mongoose.Schema.Types.Long 1) What is the correct way to show val, toString()? 2) So how do I manipulate (add, subtract) this value?...

 
2:51 PM
0
Q: Is it possible to access a localhost from a vagrant devbox?

user1122513I'm running my application on a local Vagrant VM on my computer and I was wondering if I created a node server that ran on localhost (also on my computer) would I be able to access the node server from my Vagrant application ?

 
3:35 PM
0
Q: Piping busboy file to new http request: getting socket hangup on binary files

JonathonI'm using busboy and mikeal's request library together. I'm trying to parse the results of a file upload using busboy, then forward any resulting file streams that busboy finds on to another server. var busboy = new Busboy({ headers: browserReq.headers }); busboy.on('file', fun...

0
Q: Socket.IO v1.0 broke flash game to node server communication

ewizardI setup a simple node/express app to receive data from a flash game I made, and print it to the console. I had it all setup and working, and then Socket.IO v1.0. In trying to make it work - I couldn't even get socket.io to make a handshake with the flash game client...so I did some googling and f...

 
3:57 PM
0
Q: How to upload image in Node.js

user3689905I am complete Newbie to Node.js.I just want to learn upload and showing images using ajax like i do in php.I found most of the tutorials tough for me.To get started I have tried using this code var express = require("express"); var app = express() var bodyParser = require('body-parser') //al...

 
 
1 hour later…
5:10 PM
posted on May 31, 2014 by R_G

As example I want to fetch all user John tasks, which have tags (tags not empty). Post .find({user: "John", tags : { contains objId's }) .exec( function(er, cb) { console.log( "Show only posts with tags", cb) })

 
5:24 PM
posted on May 31, 2014 by user1577607

I have a script written in javascript which does something to a drone that I have. As of now I run that script in my shell like this node foo.js and the script runs till I abort it using control C. But now I want to be able to run that script and have it listen for keyboard events that I give it (such as ENTER, up/down arrow key, spacebar), and depending on the event

posted on May 31, 2014 by Chris Paterson

I have an existing document that contains a nested array of elements (I'm not exactly sure of the terminology here). I have no problem creating the document. The problem arises when I need to insert a new element into the existing document. The code below may clarify what I'm trying to do: Controller: var Post = require('./models/post'); app.post('/post/:id/comme

posted on May 31, 2014 by Maxwell

I saw a similar question, but I'm looking for a way to do it manually. I don't want to use express or another library to do it. var http = require('http'); var server = http.createServer(function(req, res) { res.end('<h1 >Hi!</h1>'); //I want to to fetch a file ex: index.html }); server.listen(9334); How would i do that? Also as a sub-question, j

 
5:50 PM
posted on May 31, 2014 by gurpinars

I'm totally new to nodejs and I have been trying to communicate arduino and node app.My node code listens to serial port and sends datas to page.Everything is ok but a weird case has occured. var cleanData = ''; // this stores the clean data var readData = ''; // this stores the buffer sp.on("open", function () { console.log('open serial communication');

 
6:16 PM
posted on May 31, 2014 by user3692927

I have a model file, such as var mongoose = require('mongoose'); var Schema = mongoose.Schema; var User = new Schema({ firstname : {type: String, required: false}, lastname : {type: String, required: false}, email : {type: String, required: true} }); module.exports = mongoose.model('user', User); I want to create functions to update, save

 
 
1 hour later…
7:36 PM
posted on May 31, 2014 by Potherca

Working on applications in PHP I like to use a file storage abstraction layer (for instance Flysystem). This makes it trivial to switch between locations where files should be persisted to (cloud storage, local drive, ZIP, whatever) Currently I am getting started in Node.js so I was wondering if a similar module exists for node? Searching the NPM site gave me a to

 
8:00 PM
posted on May 31, 2014 by Ewan

Ok, i have spent all day on this and i am getting very frustrated with Node.js as at every turn it is almost impossible to get a foothold due to horribly over complicated explanations and tutorials that either are way to abstract or just dont work after the first 2 steps. Incredible there isn't a simple answer to this question. No more libraries, this is simple a

posted on May 31, 2014 by Kevin Kao

I'm currently trying to implement an application that allows users to request and download various datasets. Each user is only allowed to download a dataset after being approved by an administrator. What's the best way (just a general outline) to build an application like this in Sails, especially with respect to how to store the datasets (in a database, just on dis

 
 
1 hour later…
9:05 PM
posted on May 31, 2014 by Bren

I'm new to node and JS and was working thorough the socket.io chat example (http://socket.io/get-started/chat/). I came across this code in the server: var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); I've looked at other tutorials and never seen double parentheses after require before. What does the (htt

posted on May 31, 2014 by Didericis

I created a small test program for web applications that uses jasmine, and I'm preparing it for easy downloads. Before installing my package, the user's project should look something like this: myProject/ app/ lib/ ... I want to be able to have the user cd to myProject in the terminal, issue a single command that points to the app and lib folders, and then e

posted on May 31, 2014 by André Alçada Padez

i'm trying to make a $http.post like this: $http({ method: 'POST', url: '//192.168.2.1:3000/auth/signup', data: $scope.credentials, headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) when: $scope.credentials = {email: 'some_email', password: 'some_password'} and in Node, I'm logging: console.log(req.body) and I get: {

 
9:31 PM
posted on May 31, 2014 by Rikard

I have some grunt tasks to compile files and would like to "recicle" them inside different tasks. I am trying to modify the destination directory without success... My idea is something like: grunt.registerTask('bower', ['compile:index', 'compile:core'], function(){ this.options({dest: 'dist/*.js'}); }); The compile:index task runs good by itself (i.e. when

 
10:19 PM
0
Q: Socket.io sending to specific client

Harry Torrycould anybody tell me why I'm getting an undefined response? It's definitely saving the socket.io socket ID, as I've checked. The typeof the response is "undefined". It's successfully connecting, as I can see it on the server code (main.js), and I can see the uuid as well as the socket id. main...

 
10:30 PM
0
Q: Node app works with express, but getting 404 socket.io when using express-generator

N KlostermanI've succesfully created socket.io apps using express example code here. But when I use express-generator to build the skeleton, I've been unsuccessful. I'm getting the dreaded GET http://localhost:3000/socket.io/socket.io.js HTTP 404 error. ReferenceError: io is not defined I'm at a loss to...

0
Q: Node.js returning partially duplicate row from MySQL

ss1271I'm new to Node.js and "asynchronous land" and have met some strange problems. Things I intended to do: Node.js query from MySQL What was the problem: the row query from Node.js got partially duplicate columns. e.g. Here's the result by looking up the MySQL directly, please notice the userId...

 
11:04 PM
0
Q: How to handle server-client handshake in node js using streams

Halldór BjarniSo I have this Node.js program that needs to connect to a server (RTMP) and perform a simple handshake and then handle reading data from the server and sending data to the server. So this is what I've got so far: "use strict"; var tls = require("tls"); /* Performs a handshake */ var doHandshake...

0
Q: Exiting a process after a database call in Node?

Albert LimI'm experimenting with calling a database from Node, and am using the following client.execute() sample code socket.on('send', function(data){ client.execute('SELECT * FROM db.main', [], function(err, result) { if (err) { //do something } else { for (...

 
11:15 PM
0
Q: node orm hasone relationship

Cereal KillerI'm trying to use a simple hasOne relationship with node orm module: var Shop = db.define('shops', { id: { type: "serial", key: true }, name: String }); var Offer = db.define('offers', { id: { type: "serial", key: true }, name: String }); Offer.hasOne('shop', Shop); Then i wou...

 
11:27 PM
0
Q: "this" within prototype is undefined

AlonLI have spent more than a hour on that. What is wrong with this code?! StudentController.js: function StudentController() { this.studentService = {}; }; StudentController.prototype.findAll = function(req, res){ this.studentService.something(); }; module.exports = StudentController; ...

 
11:52 PM
-1
Q: Node JS REST API, now how do I serve HTML files?

MaxwellSo I did a REST Api in Node JS and now I have a blocker. app.use('/api', router); This code makes sure that every url is prefixed with api. Now what If I want to serve an HTML file when the path is just "/"? Should I create another "express" application? I'm just working in localhost right now...

 

« first day (14 days earlier)      last day (63 days later) »