Questions tagged as 'nodejs'

1
answer

Understanding async / await

Environment: sequelize 3.27, node.js 6.1, express sequelize Object.hasMany(OtherObject) I have the following piece of code: //... await db.Object.create(objectData).then(async (object:any) => { //.. object.update({sharedL...
asked by 12.06.2017 / 15:08
2
answers

Redirect only if there is a token but passing the last referer

I'm doing a redirection in site 1 to site 2 using this script built into the head of site 1: <script> window.location.href = 'http://www.sitio2.com/?redirect=true'; </script> and then in site 2 in the index.php I include this in...
asked by 24.05.2017 / 03:15
1
answer

I can not install the Laravel package.js in Node JS

My intention is to install the package that Laravel has in Node.js. This is the content of my package.js file: { "private": true, "scripts": { "dev": "gulp watch", "prod": "gulp --production" }, "devDependencies": { "...
asked by 04.07.2017 / 05:19
1
answer

Nodejs, Mongodb and Promises

I need to know how to execute Nodejs in a correct and orderly way:    Connect with Mongo.    Execute query (Insert, Select, Update, Delete)    Return results    Close connection.    My idea is that whenever you need to make a query, c...
asked by 16.05.2017 / 07:17
2
answers

res.json is not a function

This is my endpoint router.post("/users/github/:code", function(req, res) { var state; fetch('https://github.com/login/oauth/access_token/', { method: 'POST', headers: { Accept: 'application/json', 'Content-...
asked by 22.03.2017 / 21:17
2
answers

Starting with SQLite

I work with NodeJS , for a while, I've been working with JSON files to store information from many users, but now I'm facing a problem, the corruption of the data (the file is being rewritten almost constantly), so I want to move all functi...
asked by 03.01.2017 / 21:15
1
answer

pipe is not a function

I'm trying to use the module node-ds4 my code is this: var HID = require('node-hid'); var ds4 = require('ds4'); var through = require('through'); var hid = new HID.HID('\\?\hid#vid_054c&pid_05c4#6&22a63115&0&0000#{4d1e55b...
asked by 12.01.2017 / 07:58
5
answers

Modify a variable from the server with Socket.io

I need to change some variables of a script from the view of my project, but I need to do it from the server or have the variable take the value I send it through websockets . I tried the following: //EN EL SERVER io.sockets.on("connect...
asked by 27.10.2016 / 03:53
3
answers

Send notifications when you insert to MySQL from Asterisk

I would like to know how to send a notification after having made an insert in MySQL. We have a system that uses Asterisk to register phone calls from our Call Center. The issue is that using Nodejs and Socketio we want to notify of the insert...
asked by 26.10.2016 / 17:12
1
answer

Does not load CSS on NodeJS server

I have the following basic server: var express = require('express'); var app = express(); app.get('/', function(req, res){ res.sendfile(__dirname + '/public/index.html'); }); app.listen(8081); In that index.html I...
asked by 31.03.2017 / 19:34