Tagged Questions
Node.js is an event-based, non-blocking, asynchronous I/O framework that uses Google's V8 JavaScript engine and libuv library. It is used for developing applications that make heavy use of the ability to run JavaScript both on the client, as well as on server side and therefore benefit from the re-...
0
votes
0answers
5 views
Bson restful service
I'm exploring the possibility of turn my json rest service in a bson one. In other words, I mean convert the paypload in bson. I actually saw the size of the data is reduced. There are very few ...
0
votes
0answers
3 views
What's the node.js paradigm for socket stream conversation?
I'm trying to implement a socket protocol and it is unclear to me how to proceed. I have the socket as a Stream object, and I am able to write() data to it to send on the socket, and I know that the "...
-2
votes
0answers
5 views
NodeJs for static content and web api C# for data
I need to build a highly scalable website, actually i need it to be as cheap as possible since my cash reserves are rather limited.
Apart from various caching strategies and so forth, here is one ...
0
votes
0answers
4 views
Node.js serial port Access denied
I really need your help
I'm trying to make a program with node.js to act as a server for mobile app HTTP requests,and in this code in i'm trying to send a String on the Serial Port (to an Arduino).
it ...
3
votes
1answer
27 views
Where is the “.on” in “process.stdin.on” for?
I am new to Node.js.
I was on their website and I had some example code from a friend containing "stdin".
I went searching what stdin was and I do know now.
Altough, on the website from Node.js, ...
0
votes
0answers
14 views
Node.Js MongoDB is not finding query for Update
My UpdateOne query is not matching anything in the DB even though the user exits in the DB. But if I hard code userID then it matches the document. Not sure why its not matching the document with ...
0
votes
0answers
20 views
PHP Pack/Unpack implementation in Javascript Mismatch
As per this question's related answer, I'm attempting to put together a pack/unpack solution resembling this PHP process, however in Nodejs (Javascript) using md5 and bufferpack
Here's the PHP ...
0
votes
1answer
6 views
NodeJS encrypted connection string to Postgres
I am learning NodeJS by building a JWT server. Basically I want to authorize users against credentials in a PostgreSQL database. I am considering node-postgres, passport, pg to connect with ...
0
votes
2answers
18 views
How to Organize Angular 2 Files on Webhost that Uses Public Folder?
I have currently updated my server from Shared VPS to dedicated server so I can start using an Node.js environment along with gaining root access to my own server.
Everything is fine, I have git ...
1
vote
0answers
16 views
How to use express middleware to handle all routes?
I have issue setting up routes for user in below code, I want to use express middleware and trying routes using app.use.
index.js is invoking user controller method once api's is being called So in ...
0
votes
1answer
9 views
Couldn't find ionic.config.json file. Are you in an Ionic project?
I am new to Ionic and trying to run ionic serve to test my application but I keep getting this error:
Couldn't find ionic.config.json file. Are you in an Ionic project?
Tried it with Couldn't ...
0
votes
0answers
13 views
How best to automate web scraping with Express.js
I am building a web app with Express.js that charts the real-time attendance of my local gym. This data is publicly available on their website.
In order to chart this data, I will need to scrape the ...
-1
votes
0answers
13 views
Send the client data from node.js without sockets
I was using steam-login for my website, and I was wondering how I would send the client it's user file when they logged it so I could display data in the html page. I tried app.post and using $.ajax ...
0
votes
0answers
15 views
Ionic ng-repeat not working correctly
It seemed to work on phonegap correctly, however crashed a few times while making changes. However while installing ionic, covoda correctly via npm terminal this ng-repeat doesn't seem to work.
My ...
0
votes
0answers
11 views
How to create node server htaccess restriction?
I have a create-react-app that I want to deploy but I'd like to make the access to the entire app password protected (at the web server level) so crawlers or anonymous users can't access the link ...
0
votes
0answers
9 views
Ionic 2 Resources | Third Party Libraries
I want a code highlighter for my ionic v2 (rc4) project. I tried prismjs .
As said in Ionic 2 Resources | Third Party Libraries , I did the following steps:
npm install prismjs --save
npm install @...
0
votes
0answers
13 views
V8/WebAssembly version supported in node 7.4.0?
I see the following error in the WebAssembly.compile function when I try to compile binary WebAssembly in node 7.4.0 on OS X:
Result = expected version 0b 00 00 00, found 0d 00 00 00
So the V8 ...
0
votes
3answers
42 views
Check if JSON file exist, then require it
I want to check if a JSON file exists, then require it, if not, create it. That's already done, but when using the jsonfile in the code, I get `ReferenceError: config is not defined
Code:
const ...
0
votes
1answer
15 views
How to Permanently setup Class path of Nodejs in Linux Mint?
I just Tried to Install Nodejs Version 6.9.4 in Linux Mint.
I just followed these simple steps:
$ cd /tmp
$ wget http://nodejs.org/dist/v6.3.1/node-v6.3.1-linux-x64.tar.gz
$ tar xvfz node-v6.3.1-...
0
votes
0answers
15 views
Very strange behavior comparing string property in node js (vs-code)
this is from debug console:
a[0]
"15711"
a[0] == "15711"
"false"
parseInt(a[0]) == 15711
"true"
Can someone explain this?
the "a" property is one of the rows that i read from csv file with fast-...
0
votes
1answer
19 views
How to write a custom query / route in feathersjs
I feel like I am being stupid here and misunderstanding the docs.
I am trying to use feathersjs for the first time and I am slowly finding my way around.
I can create (for examples sake) a /messages ...
0
votes
0answers
18 views
How to check mongo database is connected?
I have mongodb up and running for the application how can i make sure when application start it is connected with db ?
app.js
var express = require('express');
var app = express();
...
-1
votes
1answer
22 views
numpy.random.choice in Javascript?
Numpy.random.choice is a nice simple function, that lets you sample an array of ints based on some probability distribution:
>>> np.random.choice(5, 3, p=[0.1, 0, 0.3, 0.6, 0])
array([3, 3, ...
0
votes
0answers
9 views
Renamed foreign key associations in sequelize
This project uses sqlite and sequelize. I'm used to normal sql, but this method looks useful for creating an API in Node.js.
I have two models: user and group. A group has many users, but one is a ...
0
votes
0answers
9 views
Heroku deploy cannot find js filed
I tried to deploy my node.js app. Everything had worked well but it couldn't find the javascript files. This is the error:
proove.herokuapp.com/:16 GET http://proove.herokuapp.com/js/Inputs.js 404 (...
0
votes
0answers
24 views
Display MongoDB values in HTML
I'm trying to display some user's information in a HTML from MongoDB.
For the connection to the DB, I'm using Node.js.
I want to display that info, after clicking a button (POST):
var mongoose = ...
-2
votes
1answer
24 views
what's a good file structure for projects using gulp and mocha? [on hold]
Question -- What is a good file structure for a small projects using Gulp and Mocha? All of my gulp and test files are all in the root folder floating around and I know I should separate them into ...
0
votes
1answer
19 views
How to set babel to export to es4 javascript?
I am new to babel, but I want it to export the js code in AMD style but also compatible with chrome55 and IE11.
I have this
var babel = require("babel-core");
var result = babel.transform("let x = ...
0
votes
0answers
23 views
How to write asynchronous code for Node.js and express.js
I'm trying to write long pooling.
GET /task - get all tasks
POST /task - add new task with body {"title":"content"}
GET /task-new - resolve after rxjs subscribe event so we can GET all tasks
http://...
0
votes
1answer
7 views
Heroku SSL Websocket communication
I am trying to get working my node js application on heroku. this time I fixed all of the issues but one which can be fixed two ways:
Is it possible to make heroku serve my application on classic ...
0
votes
0answers
7 views
How to use mongoose pagination with multiple filters on populate?
I have this query and need to have a total for all the posts for all pages, should I just use pagination, or can I proceed with this query some how get a total?
Is there a way to get the mongoose ...
1
vote
0answers
14 views
ResourceJS: Creating nested resources from Mongoose Schema + its child Schema?
The example code in Nested Resources with ResourceJS, shows Mongoose Schemas PARENT and CHILD, which expose the following resources:
/parent - (GET)
/parent - (POST)
/parent/:parentId - (GET)
/parent/...
0
votes
1answer
6 views
Passport JWT Express Unauthorized
I have Express as backend and am trying to add authentication using Passport.js.
I want to authenticate by password only - and a unique password located in /config/main named key:
I can generate JWT ...
0
votes
0answers
14 views
Ghost on Heroku
I'm trying to host a Ghost blog alongside a Node app I already have running on Heroku, it's working on my local setup but doesn't load on production (Heroku). I feel like it's something small I'm ...
0
votes
1answer
25 views
Get a bash script to run node.js [duplicate]
I have a node.js file that accepts an integer arg.
I'm trying to write a bash script that looks for number of available cores and launches main.js for each available core.
For 1 core it should call:
...
0
votes
1answer
11 views
Where to store node.js project own libraries?
In a NodeJS project, the folder ./node_modules keeps all project modules and dependencies.
My project have some libraries like dbConnect.js, utils.js, messages.js, constants.js, etc... They are not ...
0
votes
0answers
12 views
NPM request module inexplicable not working
I have racked my brain for hours trying to figure out why a simple post request to an API is not working when a form is submitted. The console shows that the request reaches the API controller ...
0
votes
2answers
10 views
ExpressJS - Send variable as response on POST request
I am trying to retrieve insertId of the SQL and send it back to the front end. But when I do the res.send(result.insertId), I am getting a 500 Error. How can I deliver the insertId of the sql to the ...
0
votes
0answers
20 views
JavaScript file for building an API
I would like to build an API. My application is a meteor/nodejs application. So I created an api.js file in the public folder:
document.write({ example: 'Lorem ipsum' });
I would expect to get the ...
0
votes
0answers
20 views
MongoDB Express request with query not returning 404. Any solution?
In my MEAN stack app, I'd like to use a parameter to request for complaints from certain hostels only. This is built on express js boilerplate.
complaints.js
var express = require('express');
var ...
0
votes
1answer
15 views
How to setup a mongoDB server and use it for an android application?
We are developing an android application that needs to communicate with a remote database, in order to sync some Strings. After some research it seems that mongoDB fits all the requirements.
However ...
1
vote
1answer
13 views
Full text search in MongoDB and NodeJS with text score sorting in distinct values
I'm trying to implement a full text search with mongodb 3.4, nodejs and socket.io, with distinct and sorting. So far so good, i have this code that works fine but without the sorting part:
socket.on('...
1
vote
0answers
10 views
How to run jasmine-node tests in the browser (ex. using testem)?
How do I run jasmine-node(https://github.com/mhevery/jasmine-node) tests in the browser using testem(https://github.com/testem/testem)? They both run on nodeJS but I can't figure out how to combine ...
0
votes
2answers
31 views
Is it possible to console.log a GET request in in Express?
I am trying to test the results of my crud operations for a node.js/express app on the console but it doesn't seem to work for GET only for POST.
I have this function:
app.get('/', (req, res) =&...
-2
votes
0answers
38 views
Javascript/Node.js “Function name” is not a function
So I have this function which was working fine yesterday but today when I turned PC on it stopped working. Were there any updates that I am not aware of, did i maybe accidentally delete something, but ...
1
vote
2answers
31 views
Trouble with Node JS promises
I cannot find a solution to why this function returns before my message array is updated with the necessary values.
var calculateDistance = function (message, cLongitude, cLatitude, cSessionID) {
...
0
votes
1answer
11 views
node-transmission package not working
I tried installing this package : https://github.com/FLYBYME/node-transmission in my local nodejs installation but I am getting following error while running example.js from the above github ...
1
vote
0answers
20 views
What is the best method to keep a unique identifier in sync between AngularJS and database?
My Angular/Node application displays a timeline of user events. The user can add, edit, and delete events.
When a new event is added, AngularJS adds the event content as JSON into a timeline array ...
0
votes
2answers
39 views
Use 'this' property inside _.map [duplicate]
I'm trying to call a setState function inside of a _.map loop, but the loop lost the property 'this', and I can't use setState on this because this=undefined
cargaDinamica(){
_.map(this.state....
0
votes
1answer
18 views
Mongoose hangs after using findOneAndUpdate()
what am I doing wrong?
I am using mongoose and node.js to save some data into mongodb. The program itself works, but what annoys me, is that after finding and updating documents the program still ...