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
11 views
res.render() into a div with express
I am using nodejs with express and I'm trying to load an ejs into a div like this:
app.js (server side)
//SHOW
app.get("/courses/:id", function(req,res){
console.log("requested");
res.render(...
0
votes
0answers
10 views
multiple callback in the async in node js
i am new in node js i stuck in calling multiple callback in waterfall of async method.
var offer = new Offer(req.body);
offer.featured_tag=false;
var err = '';
reserror='';
...
1
vote
0answers
17 views
Show DatePart once and then Only time in array of objects
I have following DataSet which is grouped by dates .
[ '2017-01-12',
[ { completedAt: Fri Jan 13 2017 06:32:04 GMT+0500 (Pakistan Standard Time),
Min: 658,
name: 'tariq',
startedAt: ...
0
votes
0answers
13 views
How to properly remove escaping in node
I have the following string which was the result of running a stringify command in node:
"{\"packageName\":\"com.something.something\",\"productId\":\"product_credit_50\",\"purchaseTime\":...
1
vote
2answers
33 views
How Can I run code hourly using JS?
I did something like
setInterval(function() {
console.log("!");
}, 1000 * 60 * 60);
I want to run console.log every hour but the code doesn't work like what I want.
Let's say that I run the ...
0
votes
2answers
12 views
Failed to run Mongodb
I have installed mongodb, and also created data/db folders and also add this path "C:\Program Files\MongoDB\Server\3.4\bin" in "Computer Properties>Advanced system setting>Environment Variables>path" ...
0
votes
0answers
6 views
Native node.js addon error pointer being freed was not allocated
I'm writing a function in Objective-C++ that looks like this:
Nan::MaybeLocal<v8::Object> getIconForFile(const char * str) {
NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFile:[...
0
votes
0answers
7 views
Record and save .wav file using Node.js
How can i record a PCM encoded WAV file and save it in my local machine using Node.js for an interval of time.
Any suggested libraries or packages?
0
votes
1answer
10 views
Is it safe to use write() multiple times on the same file without regard for concurrency as long as each write is to a different region of the file?
According to the docs for fs:
Note that it is unsafe to use fs.write multiple times on the same file without waiting for the callback. For this scenario, fs.createWriteStream is strongly ...
0
votes
1answer
9 views
cron job not running on aws + ubuntu + node.js
I am using this cron job package: https://www.npmjs.com/package/cron
It works fine on my laptop (executes events at certain times properly). However, the cron jobs won't run on my AWS Ubuntu server. ...
0
votes
1answer
10 views
Can we use parse server for postgresql
Currently I am using MongoDB with parse-server as back-end in my node.js application, because of business requirement I have to change my database from mongodb to postgresql. Is there any way by which ...
0
votes
2answers
18 views
Using async/await in node 7.4
I thought async/await was supported in node 7.4, however this example does not work:
const Promise = require('bluebird');
async function main(){
await Promise.delay(1000)
}
main();
Results in:
...
0
votes
0answers
8 views
npm install gets stuck at fetchMetadata on Windows 10
The message was displayed and nothing else happened afterwards...
I'm not sure why it's doing that
0
votes
0answers
7 views
How to use mt-downloader module in node
Hello guys i want to use Multi downloader module in my project. i checked git link but there is no example to how to use this module. I checked this link as example and used in my project but its show ...
0
votes
0answers
11 views
Download csv sent by NodeJS server on browser (with proper headers and other settings)
I'm building a webpage which has a button, on clicking which an AJAX call is made to NodeJS server and the server fetches the data, writes into CSV and sends the response. This data is received as ...
0
votes
0answers
14 views
nodejs - Removing user completely on disconnect (socketio)
My socketio collecting users script;
var users = [];
io.sockets.on( 'connection', function( socket ) {
socket.on('new user', function(data) {
socket.nickname = data.nick;
users[socket....
0
votes
0answers
8 views
redirect issues with accessing website on node-express server from another computer
I have a simple website that consume some APIs. This site runs on a node-express server that's hosted on my PC.
Currently on the website I send a xmlhttp request to some API, and receive a 303 ...
0
votes
0answers
14 views
Node.js -> Send/receive header (text) & body (readable stream of binary data) via WebRTC data channel?
Say if Bob & Alice are connected directly via a WebRTC data channel.
How would Bob send some text header (containing instructions to handle the body) along with a body (stream of binary data) to ...
1
vote
0answers
15 views
scripting node.js into postgres
I'm probably outta my league here as I haven't been programming long so maybe there are many errors. Any that can be spotted would be a huge help. It's my first time with node.js and I'm not sure ...
1
vote
0answers
12 views
Can I create an npm package that sets up another npm package?
I want to create an npm package that would be installed globally, with a binary to call. Calling that binary would set up the initial files for a new project, like your standard folders, standard ...
0
votes
2answers
33 views
JAVASCRIPT - Linked List vs binary search
I have prepared 2 Javascript functions to find matching integer pairs that add up to a sum and returns a boolean.
The first function uses a binary search like that:
function find2PairsBySumLog(arr, ...
0
votes
1answer
17 views
How to update on node js using sqlite3?
I would like to ask how to update on sqlite3 node js, the first function is working (views the data in the HTML from the database), my problem is how to update it. Thanks!
exports.post = function(...
0
votes
1answer
12 views
Render data sent to Express post router
I'm starting with Express and I have a question; I have the setup and everything, I've made some simple things but know I want to interact with an API, to do what I want to do I need to the data that ...
0
votes
1answer
22 views
foreach doing operation before mysql insert
I still struggle with understanding how the steps are run.
Basically i am doing a foreach computing color then insert it in a database with normal foreach
code :
var mysql = require("mysql"),
...
0
votes
1answer
11 views
Mongoose middleware post update not working
Callback is not being called, but it should as per documented in mongoose middleware:
schema.post('update', function(error, res, next) {
if (error.name === 'MongoError' && error.code === ...
0
votes
1answer
13 views
Aggregation $avg for node js
So what I'm trying to do here is I have like 100 of machine_id. In each machine id is an air_temp. I'm trying to get an output where it produces the average air_Temp with the machine id. I think I got ...
0
votes
0answers
12 views
Client is catching generic message from Node server not message I am trying to send
I am not sure what is going on here, but when I am sending back a 400, or some other error request back to the client, node is setting a generic message instead of the one I am sending back. Here is a ...
0
votes
0answers
16 views
how to put google search results in array?
Now I have google custom search box. Please, help me to get array of results of search.
<script>
(function() {
var cx = '017643444788069204610:4gvhea_mvga'; // Insert your ...
-1
votes
0answers
19 views
Fast and perfect restful api using OOP for a large project [on hold]
I got an application to develop, initially I decided to use Angular 2 as the frontend and rails as the backend with mysql. I have been studying these two for a while. But what I came to know now is ...
0
votes
0answers
14 views
Parse server returns unauthorized when created with pushed code on heroku
I have an instance of Parse Server running on a heroku app with code that I pulled from the Parse server git repo. I set my config vars, including the AppID, MasterKey, serverURL, and databaseURL in ...
1
vote
1answer
11 views
Route avaliable with or without token JWT+PASSPORT
I want that I can acess a router with or without a token. If user has a token, than give me req.user
Like this:
router.get('/profile', passport.authenticate('jwt'),
function(req, res) {
if(req....
-3
votes
1answer
13 views
looping through a file in node.js between two files
Need help on how I can loop through a file line by line between two lines with specific values. I am able to read line by line but not able to loop between two lines with specific value
E.g
Date
...
0
votes
3answers
15 views
Mongoose: condition $or with return separate
I'm using the mongoose for get the values in the DB that can corresponds with two conditions using $or.
I'm want that the response be separated by the filter.
Cars.find({$or : [{color: 'blue'}, {...
0
votes
0answers
7 views
gcloud App Engine Flexible Strangeness with Docker and Babel
I've been deploying a server side node application to a custom app engine runtime for a few months with no troubles. The only half interesting thing about it is that a run babel against the source ...
0
votes
1answer
9 views
ng-cli error in Node js 7.x
I am using Windows 10.
I installed nodejs 7.4.0 using windows installer.
I installed typescript globally.
I installed ng-cli globally.
Then I went to command prompt into my new project folder and did ...
0
votes
0answers
7 views
Bookshelfjs + bcrypt hashPassword is working on create but not on update
I am using bcrypt hash password in bookshelfjs which works fine when I make an insert query while signup, however its not hashing the password when I try to update the password.
model.js
var ...
0
votes
0answers
14 views
Dynamically add fields to Mongo
I have an application where I would like to have a user make custom named groups, Im having a hard time figuring out how to have them save properly to the database. At first I was going to have groups ...
0
votes
0answers
7 views
sending mail using self hosted mail server Haraka nodejs to Internet
Just noobs question in smtp server administration, I had simple mail server local setup and is working fine for local network. I want to rent vps service and copy all my either dovecot and haraka ...
0
votes
0answers
17 views
Writing to a MySQL database with Ember and Node.js
I’m new working with Ember.js and I’m confused about a few things. My real issue is working with MySQL and ember-data. I’ve worked through a few tutorials and found this youtube very useful. At this ...
0
votes
1answer
20 views
Node.js: How can I get the reference for a Firebase Database Data Snapshot
I have a folder for each user. I have a DataSnapshot name "snapshot" that selects an item of the user that has been changed.
Using the following code, i get the snapshot for the item I want in the ...
0
votes
0answers
10 views
'Error: Cannot find module' after fork and patch
I forked an npm package (https://github.com/spark/particle-api-js), made some changes, used that in a project (https://github.com/RoomKit/RoomKit-Backend) and then left it for a while.
I resumed ...
0
votes
1answer
10 views
Return value from Google Cloud Translate API in Node JS
I'm playing with the Google Cloud Translate API using NodeJS. I can console.log the value returned from a promise. But I'm unsure how to pass that value into a template file like EJS. All that shows ...
0
votes
0answers
3 views
Uncaught Error: addComponentAsRefTo after building searchkit v0.10.1
I'm trying to build this package:
https://github.com/searchkit/searchkit/ (version v0.10.1)
I'm fetching repository,
npm install
npm run build
nothing special.
But after trying to use this module ...
0
votes
0answers
21 views
Import text json for node js template literals
For my node js projects i typically have a text.json file and require it, instead of having static text within my code. something like below
JSON file
{
"greet":"Hello world"
}
var text = ...
1
vote
1answer
21 views
Working With SmartSheets API, Loop Through List for Variable of a Function
I have a list of numbers like below stored into a variable.
[700000000084,
100000000051652,
8800000000000072,
280000000000004,
680000000000008,
880000000000006]
I am trying to loop this through the ...
1
vote
3answers
43 views
JSON get and show on html page
i'm making a web app, and i need to get data from JSON files and print them in form of a table.
Problem is that i'm getting a 404 error, JSON file (actually i work on local and doing a Node.js).
Edit ...
0
votes
1answer
10 views
express-restify-mongoose query multiple attributes
Problem:
I am trying to send a query to my nodejs server from angular2 using express-restify-mongoose that will search through more than 1 attribute.
What I have (works):
let regex = '{"title":{"$...
0
votes
1answer
19 views
Is there a way to throw a system error like ENOENT or EPIPE?
I want to test my process and make sure it is resilient to EPIPE errors, since we're seeing them in Prod and they don't seem to be any problem other than missing some logging.
if (process.env....
0
votes
1answer
16 views
npm ERR! Failed when make ionic serve command (ask for checking version of node.js and npm installed)
I am trying to create a docker environement (that I wish to use with git and my team) with ionic framework 2.
I have a project directory named ionic-boilerplate. In this directory I have an ionic app ...
0
votes
0answers
13 views
Node and PUG how to handle submit button in the code
I am posting my code below. My question is how do I get the PUG submit button to work. Ultimately I want to return to the page but disable some of the selections.
File app.js
var express = require('...