Tagged Questions
0
votes
0answers
7 views
Setting session expire time - Sails.js
I have a web page that uses session variables. How can i set an expire time for a session? eg: after 15 minutes of inactivity , have to destroy the session.
I tried in config/session.js , but in ...
-2
votes
1answer
7 views
NOMP - Undefined string
I've done the instructions given at their github page:
https://github.com/zone117x/node-open-mining-portal
Now, I'm getting this error when I'm running
undefined:1
...
0
votes
1answer
11 views
partial class methods in node.js using lodash?
I would like to create a function in node.js which takes an integer value and converts it into a binary string using lodash/underscore's _.partial/_.partialRight.
var _ = require('lodash');
var n = ...
0
votes
1answer
8 views
Node.js + Mongoose.js How to get sum of orders are placed in a month or a week?
I find out the aggregate framework, but how to get the doucments in a month or a week? I am tring to calculate how many orders are placed in a week or in a month. The documents are like this:
{
...
1
vote
1answer
23 views
Node.js application crashing
I am just beginning with node.js and was trying to deploy Pusher's example authentication code but it fails
Here is the code -
var express = require( 'express' );
var Pusher = require( 'pusher' );
...
0
votes
0answers
9 views
update (preferences)schema by connecting different schemas
I'm new to node.JS/mongodb(mongoose). I've built an API that for my app to communicate to. One route it has is to set the user's preferences.
Here is my model: preferenceModel.js
var mongoose = ...
2
votes
1answer
21 views
Node.js fs.watchFile, Is it possible for it to check for changes once and no more?
new to node.js and just looking through a doc on the watchFile "module"?
(I don't know if you call it module or method or whatever)
My current code looks like so:
var fs = require("fs");
...
-1
votes
0answers
11 views
Host grunt-triggered nodejs application inside IIS
This might be a silly question, but I just get started with nodejs/grunt so please bear with me.
I have a nodejs application that is normally triggered by typing in "grunt server --force" from ...
-1
votes
1answer
22 views
Dynamically displaying JSON data in browser with node.js without refresh
I have this simple node.js server that grabs JSON data from an external source and then displays it in a browser window. How can I make it update every minute (when the JSON is updated) automatically ...
2
votes
0answers
12 views
Scoket.IO Token based auth — can't pass token?
I am using this tutorial to get the basics of a token-based auth system in place. Here is the code I'm using:
In app.html:
var socket = io('', {
// originally I thought the $.param might've been a ...
0
votes
1answer
21 views
Printing formatted, rendered html content
I have been searching google for examples or jquery plugins that allow you to print an html page exactly as it is rendered.
I have a nodejs web application and I need to create some nicely formatted ...
1
vote
1answer
16 views
Production Node Application Can't Find SVG Files
In my local development application the svg files show up just fine with the following code (The curly brackets embed Angular.js variables):
<img ng-src="img/servant_{{servant.personality}}.svg" ...
0
votes
0answers
23 views
Is there a version of assert.deepEqual that does strict (===) equality checking?
I was hoping assert.deepStrictEqual would exist but it doesn't. Is there an equivalent in either node.js itself or a library?
Edit: to clarify, I would like [1] to be equal to [1] but not ['1']. ...
0
votes
0answers
16 views
Express 4 and socket.io
In the past, listening servers would be created in the app.js file so when you wanted to run your server you would use this command.
node app.js
I have recently gotten back into nodejs and am now ...
1
vote
1answer
22 views
http request with node.js fail Can\'t set headers after they are sent
I try to request a server with https/http and display the result in a web page.
It's work as a script on a server but fail with i return the result with a get request.
var express = ...
0
votes
1answer
22 views
How to pass a third argument to a callback using Bluebird.js nodeify
With a little help I've arrived at the following code to promisify a passport.js login strategy.
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var ...
0
votes
0answers
28 views
How can I store the output of this plugin as a variable, so I can reuse it?
Gulp frontmatter can extract yaml front matter, and "adds a new frontMatter property to the file object" (quoted from documentation).
However the documentation is rather sparse, and I'm having ...
0
votes
1answer
25 views
Node.js - Help Converting XML to Custom JSON
I'm building a xml to json function which converts our XML structure to a specifically formatted JSON.
I've tried many libraries, and ultimately, I've settled on just turning the XML into a DOM tree ...
0
votes
2answers
16 views
Express failing to look up view
I am trying to create a SPA app, but when i start my application it does an infinte loop leading to a crash. I am using ExpressJS 4.3.0
App architecture:
public
--partials
...
0
votes
2answers
21 views
nodejs tools for automated authoring
Nodejs is a powerfull tool, but makes my life hard, because I have to create a server by hand, from scratch.
I have no experience with writing code to manipulate server connections and implementing ...
0
votes
0answers
7 views
deletedRecord doesn't match the attribute defined in MODEL
For instance, I have following attributes defined in model.
attributes: {
firstName : {
type : 'string',
defaultsTo: null,
size : 30,
...
0
votes
1answer
12 views
Websocket Error: Error during WebSocket handshake: No response code found in status line
I want to make a tcp connection to my server.
But i get en error everytime...
WebSocket connection to 'ws://my.ip:1337/' failed: Error during WebSocket handshake: No response code found in status ...
2
votes
2answers
27 views
how to check if a string matches a pattern with asterisk
I have a list of files:
var files = [
"user_parse_info",
"user_parse_age",
"site_render_info",
"site_parse_name"
]
Now I have string a pattern:
var pattern = "site_*_name";
This ...
0
votes
0answers
5 views
How to let grunt usemin update the JS to reference our revved images?
How to let grunt usemin update the JS to reference our revved images ?
from the yeoman web app generator, it only rewrite links for css and html, but no js.
What if my JS file have some images need to ...
0
votes
1answer
21 views
Node.js with MongoDB driver - trying to get valid JSON output with quotes around keys
I am very new to Node.js (and only slightly less new at MongoDB) - I am trying to figure out how to produce valid JSON using the native driver. The code below produces results, but the keys are not ...
0
votes
0answers
18 views
Save html as pdf in node-webkit
I'm working on a node-webkit desktop app for windows and I'm trying to find the best way to allow the user to save an html table view as a pdf from the application. The application has to run out of ...
1
vote
1answer
14 views
Time complexity/efficiency of Node.js emitter.removeListener(event, listener)
What is the time complexity of Node.js' EventEmitter.removeListener(event, listener) method in terms of number of listeners which are bound to a specific event on the emitter?
Link: ...
1
vote
1answer
20 views
nodejs - use string patterns to match filenames
I have some files to include:
user_parse_info.js
user_parse_age.js
site_render_info.js
site_parse_name.js
Now I want to use patterns to determine which files will be included. Example:
$ node ...
1
vote
2answers
34 views
Bitwise operators in node.js with big numbers
Trying to get a xor of two big numbers, the result is not correct.
example:
> 7894237947293^4353453453
105105424
while on python, for example, it gets the correct answer:
>>> ...
4
votes
2answers
26 views
Variable in parent scope not getting altered in anonymous function [duplicate]
I'm using the opentok SDK for video chatting, and I need to create sessions. It's pretty straightforward, and that part's working fine. This is all being done in node.js, server side.
The issues is - ...
0
votes
1answer
18 views
How does the XMPP server route a message to a particular user?
Read a few similar questions about pushing data to a client.But none of the answers were satisfying.
Taking Facebook as an example where thousands of people talk to each other using instant ...
0
votes
1answer
16 views
Using different router for different subdomains in node.js with express
I want to use different routes in my app, depending on the subdomain in req.headers.host.
So I came around with this idea (extremely simplified example):
var express = require('express');
var ...
0
votes
0answers
15 views
socket.io disconnected event not raised in case of pc switched off
I am using socket.js to getting online users on my web application made in node.js, It is working fine. When socket connect, I am adding user as online, and when socket gets disconnected, set user as ...
0
votes
1answer
17 views
Update mongo array field from angular
I have this jade file:
<tbody>
<tr ng-repeat="lineas in datuak">
<td class="tdlinea">Linea:{{ lineas.linea }}</td>
<td data-ng-repeat="nireindex in ...
0
votes
2answers
25 views
HTML voice chat width Phonegap and node.js
Is it possible to make a live voice chat on a HTML app width Phonegap and node.js?
Alex,
1
vote
1answer
26 views
Node.js http server
I am trying to create an http server that reads only POST requests and returns the body of the request in upper case. This is my code:
http=require("http");
fs=require("fs");
...
0
votes
2answers
24 views
Loading XML file into NodeJS as a JSON
I'm trying to load an XML file into my nodeJS project as a JSON and having some issued. The console.log(JSON.stringify(obj)) returns an undefined value.
var returnJSONResults = function(baseName, ...
0
votes
3answers
30 views
node js error - Can't sent headers after they are sent
I'm using the ebay-api for node-js, and when i'm refreshing the page for some reason i get an error.
in the console log i get the errors of "can't send headers after they are sent."
Here is my code, ...
0
votes
1answer
12 views
debian wheezy / cassandra / nodejs
i try to use node-cassandra-cql to communicate with cassandra(1.1.12) but when i try a simple connexion :
node connect.js
connect.js source :
var cql = require('node-cassandra-cql');
var client ...
0
votes
1answer
18 views
illegal token when using data from res.json using Node and Express 4
I've created a simple bookmarks service for myself with a REST api built in Node using Express 4:
res.json(200, output); // output is an object
Using POSTman I've tested the api fully and all is ...
0
votes
1answer
12 views
How to use knexjs globally in a sails js application
how do i get the knex object in my controllers or any other model files if i am not using waterline.
for eg.:
in my api/models/Users.js
module.exports = {
find : function(id){
// my ...
-2
votes
0answers
14 views
Filtering nested JSON in rethinkdb
My rethinkdb contains json objects with following structure.
{
"destination": {
"name": "Koti Bus Stop"
} ,
"first_down": "03:40" ,
"first_up": "03:40" ,
"frequency": ...
0
votes
0answers
7 views
Unable to use Kue's UI after login via Express
i've a little problem with Express js basic auth: in lame term, after that i login, it return me a TypeError:
TypeError: Object # has no method 'path'
This is the incriminated code:
var http ...
0
votes
1answer
20 views
Returning results from a series of callback functions in Node.Js
I have an exports function in my Node.Js / Express app, which I want to return a certain value obtained through a series of callback functions inside of it. Trying to make it work for several hours ...
0
votes
1answer
15 views
Include Dependent JS files in Node JS
I figured out how to include a JS file in Node JS. But I have a JS file(hashing.js) which uses a function from other JS file(encoding.js).
In encoding.js, I have
exports = exports || {};
...
0
votes
1answer
36 views
using local variable in callback function
My goal is to execute some javascript functions sequentially, where results from one functions often (but not always) used as arguments of another.
var async = require('async');
var commonFunction1 ...
0
votes
0answers
5 views
Mongoose gridfs-stream how to populate fs.file collection
I'm using gridfs-stream module in nodejs for storing images.
var db = require('config/db');
var Schema = require('mongoose').Schema;
var schema = new Schema({
name: String,
photo: ...
-1
votes
3answers
44 views
cordova platform add android error on windows 8
I am a new bee to phonegap and have just started going through this tutorial here.
So please go easy with me :)
I am trying to add android platform and getting this error:
C:\Users\Manu>cd hello
...
0
votes
2answers
31 views
Repeating output to the console - where do I have to insert my callback?
This is my code so far:
var databaseUrl = "mydb";
var collections = ["users", "reports"];
var db = require("mongojs").connect(databaseUrl, collections);
newuser = {
email: ...
0
votes
3answers
29 views
Node querystring parsing and character encoding.
I have this code:
var qs = require('querystring');
var http = require('http');
http.createServer(function (req, res) {
if ('/' == req.url) {
res.writeHead(200, { 'Content-Type': ...