I'm trying to use a PEGJS parser in multiple different files. I use the method var Parser = require("./Parser"); When I try to parse something using Parser.parse, though, I am unable to do so, because Parser is undefined. How can I fix this? It had been working previously, but I made some chang...
I'm fairly new to this so please ask for more detail if I'm not providing enough. My issue is that my site is serving to www.mysite.com but not to mysite.com - however if I ping I get the opposite results... mysite.com responds and www.mysite.com can't be found. DNS-wise I think I'm good, but ob...
I am running into an issue when I try to run "npm install -g express" and "npm install -g express-generator". Here is the error message for both. I have been able to install Express in the past by using package.json, but not through npm. Any ideas? : "npm install -g express": npm http GET https...
When I try to find all members within 50km of Salt Lake City, Utah from the Mongo shell I get the error: error: { "$err" : "point not in interval of [ -180, 180 ] :: caused by :: { 0: 0.0, 1: 50000.0 }", "code" : 16433 } Here is the query I am running: db.members.find( { 'geo.point...
Greetings from a new user of Visual Studio 2013 Express for Web that was freshly installed about two weeks ago. I would really appreciate any help or guidance regarding my issue below: For years, I've used MS Expression Web (and Expression Studio) versions 1-4 and am now migrating to VS 2013 Exp...
I am trying to install the Bitcore module for node on Windows 7 and am running into a few errors. Tried for quite a while to fix this but am not getting anywhere. Any pointers would be really great. npm http GET https://registry.npmjs.org/ruglify/-/ruglify-1.0.0.tgz npm http 200 https:...
I've created a full node-webkit app that works fine on the Mac OSX version of node-webkit. Everything works, it loads a key external nodeJS module (marked), and the world is good. However, when I try to run the app on the Windows version of Node-webkit as described in the Wiki, the app crashes i...
Here's my setup Server var webrtcServer = new PeerServer({ port: 9000, path: "/wrtc" }); Peer 1 (running inside a node-webkit application) var peer = new Peer( 'masterName', { host: 'localhost', port: 9000, path: '/wrtc' }); peer.on( 'connection', function(conn) { co...
I'm using node-soap to create a soap-webservice. When client send a soap message with header , I don't know how to get these header. Help me !
I am a Beginner level web developer and I want to try PhoneGap but for installing PhoneGap we need to have Node.JS, which I have been trying to install for the last 2 days but no hope. Every single time I try to install it, the install wizard prompts an error saying that NodeJS setup wizard end...
Its a simple todo list, I wanted to try it in ajax from javascript. app.js var express=require('express'); var MongoClient=require('mongodb').MongoClient; var db; MongoClient.connect("mongodb://admin:[email protected]:10070/todo",function(err,database){ if(!err){ console.log(...
I'm looking at PassportJS for authentication and have a login form with username and password. But if I look at the documentation, I see that the password is passed in clear text. Which means if anyone does a console.log(password), the password will be visible. How do I ensure the password submit...
In data.js, I have a big object array and a couple of functions: var arr = [ {prop1: value, prop2: value},...] function push (value) { arr.push(value); } function pop () { arr.pop() } module.exports.data = arr; module.exports.push = push; module.exports.pop = pop; To load the array &...
My node.js client looks like this: var MongoClient = require('mongodb').MongoClient; MongoClient.connect(mongoendpoint, function(err, db) { if(err) throw err; var collection = db.collection('test-collection'); var ws = new WebSocket(websocket_Endpoint); ws.on('o...
Suppose I have a server-side Node.JS game. What are some strategies to detect if the client tampered with JavaScript headed back to the server? Are there any best practices for verifying data sent from the browser to the server?
I'm trying to set up authorized file access on nginx backed by node.js. For some reason all the examples don't work for me. I'm trying to server files from /data/private/files My nginx configuration: ... server { listen 4000; server_name localhost; location / { proxy_pass h...
I've tried Istanbul to get a cover test for my application. All seems to work fine, but some methods are marked as not covered and I'm sure (beacause of logs) that those functions are covered. Here is the code I want to test (it use Mongoose) : var mongoose = require('mongoose'), Schema = mo...
This is my html code: <form id="fileupload" method="POST" enctype="multipart/form-data"> <div class="row fileupload-buttonbar"> <textarea name="txtFolderName" rows="1"></textarea> <button type="create" class="btn btn-primary start"> <i class="glyphicon glyphicon-upload"></i
I try to use JMeter running benchmark on pure node.js and express server. And the result is : node.js = 600 RPS, express = 1200 RPS while running benchmark, node.js server always use 1 cpu, but express server uses all. Does this means that express server uses cluster by default ?
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': 'text/html'}); res.end([ '<form method="post" action="/url">', '<h1>My form
This is my code so far: saveuser = function(user, callback) { //... }; removeuser = function() { //... }; finduser = function() { //... }; updateuser = function() { //... } var options = { 1: { option: "Save a User", execute: saveuser.bind(nul...
I'm writing a simple module that first will connect to socks5 then go to imap server (like imap.gmail.com:993). I successfully create a connect to Socks5 server and create tunnel to imap. But when I try to wrap it by tls.connect({socket: socks5SocketHandle}) I always get follow error message: ...
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: Schema.Types.ObjectId // store file ObjectId }); var model = db.model('User', schema); model.findById('12...
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 = function(arg1, arg2, callback) { // callback(err, res1, res2) callback(null, arg1 + arg2, 11)...
When I tried to install zmq package in node, getting the following error npm http GET http://registry.npmjs.org.org/zmq npm http 200 http://registry.npmjs.org.org/zmq npm ERR! registry error parsing json > [email protected] preinstall /home/sabarish/Desktop/node_modules/zmq > node-waf clean || (exit 0)...
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 || {}; exports.encoding = encoding function In hashing.js, I have exports = exports || {}; exports.hashing = h...
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 but can't find the right way... Maybe you can help? Here's the code: exports.finalResult = functio...
So the situation is this: i'm able to authenticate and get/send messages with one fb account, with other two authentication is failing. It should work for all accounts, or not work at all and i'm not able to find the answer of this strange thing. What i'm missing? Steps: Using example app: htt...
I m giving this error.but ide have jade plugin. An exception occurred while executing watcher 'Jade'. Watcher has been disabled Fixit.: Invalid executable
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 = require('http'), app = http.createServer(handler), io = require('socket....
My schema is as follows : - var Schema1 = new mongoose.Schema({ name: String, description: String, version: [{ id: String, status: Number }] }); I want to unset the version field. I try the following code :- Schema1.update({}, { $unset: { version: 1 } }, { multi: true })...
Tried to use mongo-log-rotator in nodejs but have no luck, receiving error { version: '2.4.9', file: null }. var Rotator = require('mongo-log-rotator'); // Every 30 seconds. var schedule = '10 * * * * *'; var rotator = new Rotator(schedule, { mongoURL: 'mongodb://loca...
I'm unable to find my ~/data/db folder that i created for MongoDB. I created it with "sudo mkdir - p /data/db" in my root folder. I am unsure of what the "sudo" command does as it seems the folder is hidden in some way. If i navigate to the root folder it does not contain a /data/db folder. Alth...
I am trying to make a REST API controller for getting user details in node.js using coffee. Here is my code: get_get: (req, res, params)-> @m_auth.can req.user, ['SUPER_USERS_GET'], (err, result)=> if err? || !result? || !result console.log err return res.send 401, { message: c...
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 working. I'm now trying to load the data with jQuery's $.post function: $.post( "http://my.uri.com...
I am making an angular application for Dashboard. I am making several http requests from my controllers. When i build this project using grunt, it runs well on my machine and fetches the data from the express server which is also running on localhost on port 1222. But when i run the built code on...
Trying most of the websocket engines I've concluded using Primus (a universal wrapper for real-time frameworks) so to be able to test any websocket framework that may come around without changing my functionality. Even though that Primus does what it says, i've found myself in the situation were...
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 = new cql.Client({hosts: ['localhost'], keyspace: 'LIBRE'}); client.execute('SELECT * FROM Perso...
I'm using the ebay-api for node-js, and when i'm refreshing the page for some reason it send the data twice and therefore 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, can you figure out where am i double sending the requests ? ...
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, queryName) { var XMLPath = "SomeFile.xml"; var rawJSON = loadXMLDoc(XMLPath); function...
I am using redis to send a session cookie from PHP to Node/Express. The only way I seem to be able to access the cookie in my server.js code is if I create an empty file on the client and include it like this with the port: <script type="text/javascript" src="http://dev.nodetest.com:8080/empty.js">
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"); http.createServer(function(req,res){ if(req.method=="POST") { var body = ''; req.on('data', function (data) {body += ...
My question is very similar to the one already asked here. However the length (and input) of the array are read from a file. How can I evaluate the boolean expression in my example? fread(length, 4, 1, file); array= calloc(length, sizeof(*array)); fread(array, 4, length, file); b = 7; // I wa...
I am currently working on an open-source hardware & software for home automation, wireless sensors like temperature sensors, humidity sensors etc. The system is using low-cost 2.4 GHz (non-wifi, non-bluetooth) wireless modules (nodes) and a Raspberry Pi with a Wireless Module is collecting all t...
I have this simple form code which works perfectly with the node.js and mongoose, it saves data and everything but as soon as I add my other bootstraps features it doesn't save any data into database any more. Here are the two codes: The one which works perfectly: <div class="row"> <div cl...
var mysql = require('mysql'); var mysqlPool = mysql.createPool({ host : 'localhost', user : 'nodejs', password: '', database: 'nodejs' }); // somewhere inside a method: mysqlPool.getConnection(function(err, connection) { // do some queries connection.release(); }); ...
I'm trying to create a node module that will interact with the github API, but will cache results in redis. You can follow my progress at https://github.com/shamoons/github-redis-etag (please, fork me!). As a base, I'm using the github package by mikedeboer. What I want to do is create a class t...
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 offline. It is working well if user closes tab/browser or doing logout from app, But when PC/comp...
How fix this problem, if table don't have any data in table, i get error and nodejs server stop running. How can i ignore error, then table is clear. /home/pi/app/project/app.js:377 if (!row) return done(null, false); ^ ReferenceError: done is not defined I am us...
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 domain1 = require('./routes/domain1'); var domain2 = require('./routes/domain2'); var app ...
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 messaging.I know there are lot of details involved behind it.I have read this [http://www.erlang-factory.c...
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 - and it's mostly cause I still don't quite get var scopes (especially with anonymous functions an...
I often see node.js programmers, when calling functions that expect callbacks, do this: callSomeThing(arg1, arg2, function (err, data) { if(err) { // Handle the error case } else { // Proceed normally } }); Is there any particular reason why they use an else block inste...
I can't seem to figure out how to include a file using Node.js. All of the other questions seem to discuss including other JS files, but I'm looking for the equivalent of a PHP include (files that can contain HTML content). Usually in PHP, my view files like this: ...stuff <?php include 'heade...
I have this on code: Object.prototype.getKeyByValue = function( value ) { for( var key in this ) { if( this.hasOwnProperty( key ) ) { if( this[ key ] === value ) return key; } } } and new User({ id: 1 }).fetch().then(function(collection) {...
I am trying to create a grunt task to build a javascript project using requirejs with closure compiler as the optimizer. I am using the grunt-contrib-requirejs plugin. https://www.npmjs.org/package/grunt-contrib-requirejs Although I haven't explicitly setup the closure compiler, here is the con...
This object thing do not work any method i apply .... suggest me some thing tried many things like load $('.talk-pip__container').children('object').load(function() { }
I developed web site with LAMP, where I need users to chat with each other, make group chat or PM. I googled the solution and found that the best way to create chat/messaging application is NodeJS & SocketIO. I wrote small chat client/server application with Node and Socket. But I have a problem,...
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 the box, so I can't ask the user to install any third party programs to get functionality working....
We are using node js, redis, php & mysql in our stack on Ubuntu 12.04. It's an internal application, and we're trying to get real-time notifications working correctly. There's a lot of code, let me know exactly which pieces you would like to see - I'll post them. Here's where I'm at: Whenever a...
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 enclosed in quotes so my application is choking because it considers it invalid JSON. var MongoCl...
I'm using the twit Node.Js module for dealing with Twitter API. Right now all the things that my app does are done from my own application registered on Twitter. However, what if I want to log in my users using their Twitter details and let them use Twitter through my app? How would this be done...
I have read a lot of different posts before asking here but I can't get through that error "Uglify not found".. I have downloaded node.js, uglfy.js.. Shortly I have followed all the steps here.. How to install grunt and how to built script with it So every time as I enter "grunt", it gives that...
I'm using NPM's scripts.postinstall to build our application using GulpJS when we push it to Heroku: "postinstall": "./node_modules/.bin/gulp build --require coffee-script/register" I want to be able to set an environment variable at this time with the value of the commit hash. This will then ...
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 be compressed, but cannot link :( Here is my current parts of grunt.js useminPrepare: { ...
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 should match only the last file. How can I check this? Maybe an RegExp?
I have been struggling with performing simple authentication in my angular node application. I am well aware that there are ready to use angular-express yeoman kits out there. But I want to understand this fuly and hence the attempt. What I have been able to do so far is create a login form whic...
While making realtime chat with express.js and socket.io I noticed strange behaviour of Chrome browser. When i paste chat address (http://localhost:8000/) to address bar it connects to site instantly, without pressing enter. This does not happens in Firefox. Any suggestions? Thanks
For instance, I have following attributes defined in model. attributes: { firstName : { type : 'string', defaultsTo: null, size : 30, columnName : 'FIRST_NAME' }, lastName : { type : 'string', default...
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 ----index.jade server.js My express code: var app = express(); var port = process.env.PORT || 8080;...
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 that I can walk and convert to JSON myself because the libraries don't provide the format I need...
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 trouble figuring out how exactly I would use the extracted frontmatter. Say I want to store the extract...
I want to serve socket connections from a Flash browser client, and therefore I need to add support for the policy-request-file protocol. I can't run the policy-file-request service on the default port 843 because of firewalls etc. The only option I have is to server the protocol on port 80, besi...
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 Promise = require('bluebird'); var bcrypt = require('bcrypt'); var db = require('./db').db; //users are...
I encountered a very peculiar problem. I was trying to get express + passport to work. As vast majority of the examples online were for express 3, the process took me sometime - eventually I got the google authentication to work. I was trying to bind the google account to a local account, which r...
I have an architecture based on multiple stateless webservices loadbalanced with haproxy. Theses webservices host a cloud storage system that allow users to upload files at a predefined bandwidth depending on the plan the user suscribed. When the user is connected to his space a websocket is ope...
I have deployed an app on heroku, and i can upload images by submitting a form, but these images which were added to public/img/portfolio folder is deleted when my dyno sleeps after one hour or more. How can i upload image files to a remote server on NodeJS (the other server doesn't support nodej...
I have a strange problem with sailsjs that is slowly driving me mad. I have logged into my app and can access the req.session.user object. However when I try to create a 'sale' which has a seller_id of the logged in user it errors out. As you can see below, in my controller action I am setting va...
I would like to do ACID Transactions with ArangoDB. And I would like to send the transaction Code (nodejs-code) to the ArangoDB server where it will then be executed and hopefully commited or rolled back if it fails. But at the ArangoDB serverside I need the NPM Decimal module or called package i...
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 = require('express'); var app = express(); var port = 1337; var https = require('https'); app.get('/', function(req...
I'm trying to get a list of all my friends (their usernames) on Facebook. I tried using this github project: https://github.com/lorensr/facebook-emails But, the new Graph Explorer API doesn't let you find every single Facebook friend so that method doesn't really work. Any other ideas? Thanks
I am working on a small web portal, and I've run into an error when I am uploading files(images) > ~25kb. I've tested the system, and it works great with small images, but then when I try a larger image, everything breaks. I am using the latest version of node, express 3.4.0, multer 0.0.7 and he...
The error: events.js:72 throw er; // Unhandled 'error' event ^ Error: channel closed at process.target.send (child_process.js:402:26) at SerialPort.<anonymous> (/var/www/my_project/serial-worker.js:30:13) at SerialPort.EventEmitter.emit (events.js:95:17) at ...
I've added execjs and therubyracer to my gemfile already and downloaded node.js but I'm still getting this error: C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.1.0/lib/execjs/run times.rb:51:in autodetect': Could not find a JavaScript runtime. See https://gi thub.com/sstephenson/...
I've deployed a nodejs worker. However whenever I try to start it, it gets red and this error is showned: ERROR Instance: i-6eef007a Module: AWSEBAutoScalingGroup ConfigSet: null Command failed on instance. Return code: 1 Output: Error occurred during build: Command 01-start-sqsd failed . I do...
I was hoping assert.deepStrictEqual would exist but it doesn't. Is there an equivalent in either node.js itself or a library?
I am trying to write integration tests using Mocha against a feathers service and a mongoose model, but I get a timeout: Error: timeout of 2000ms exceeded. In my describe(...), I have made sure to call mongoose.connect(...), but it doesn't seem to make a difference: before(function (done) { ...
I'm using gulp and running nodemon from a task. Everytime it detects changes it restarts the server runs "build" task Yup in that order. Couldn't figure out how to kick "build" task before nodemon's restart happens (setting delay param didn't help). nodemon = require "gulp-nodemon" runS...
I'm building a mobile app with html/js/phonegap/angularjs. I would like my users to be able to upload photos from their phones directly to google cloud storage. How do I do this? I've seen this jwt stuff https://developers.google.com/accounts/docs/OAuth2ServiceAccount but I've also found this app...
« first day (11 days earlier) ← previous day next day → last day (66 days later) »