Questions tagged as 'nodejs'

1
answer

Save the data of a postgresql query in javascript?

I am using Nodejs, for the postgresql part I am using pg-promise. The query is performed with the following function, but I would like to save the data variable, which is the one with the values of the query, so I can use them later....
asked by 01.12.2016 / 21:02
1
answer

test neural network library

I was testing the library link , this is my code var synaptic = require('synaptic'); // this line is not needed in the browser var A = synaptic.Neuron(); var B = synaptic.Neuron(); A.project(B); A.activate(0.5); // 0.5 B.activate(); // 0.3244...
asked by 23.11.2016 / 15:12
1
answer

Convert an array to a .json file

well this is my code var miJson = JSON.stringify(miArray) ; but I need all the data of the variable "miJson" to be in a file with the extension .json     
asked by 15.11.2016 / 14:54
1
answer

Mix content files in nodejs

My code is: var files = fs.readdirSync('./archivos/'); //itera todos los archivos for (var a in files) { if (fs.statSync('./archivos/'+files[a]).isFile()){ var nombreFile=files[a];...
asked by 07.10.2016 / 22:02
1
answer

does not return the function read file nodejs

the read file function does not return anything, but if it shows by console function leer(archivo){ fs.readFile('./archivos/'+archivo, 'utf8', function(err, data) { return data; } ); }; when I us...
asked by 07.10.2016 / 02:33
3
answers

Can you install Node.js in a Shared Hosting Service?

I am doing a project with Php but I need to use Node.js to add more functionalities to the project, but this is hosted on a shared server, and I had a question. Can Node.js be installed on a shared server? and if this is not how I can work using...
asked by 13.10.2016 / 01:04
3
answers

require is not defined javascript

I have the following problem, I try to call a dependency in this way but it tells me that the word require is not defined, I would like to know if it can only be used on the express server or on any server that is used on node. var Twitter = r...
asked by 14.02.2016 / 16:24
1
answer

Display a random word, from a JSON object stored in MongoDB, every 5 seconds

I have an Ajax request that extracts data from a JSON object created in MongoDB and shows them to me on the screen. But what I'm stuck in is showing a word, from that array, randomly every 5 seconds. I have made the setInterval and it works, but...
asked by 20.11.2018 / 13:12
1
answer

Error Converting circular structure to JSON

When listing the elements in the database I get the error "Converting circular structure to JSON", how can I solve it? BD Model const mongoose = require('mongoose'); const {Schema} = mongoose; const PostSchema = new Schema({ text: { ty...
asked by 15.11.2018 / 02:47
2
answers

Reload the page when submitting in a form that consumes an API

I have a form in a modal window, which makes a POST to an API on the server, and then the server saves the information in the DB. The server is made with Node Js and express. The problem is that when doing the submit, the IP address of the API i...
asked by 04.12.2018 / 02:31