How to await and return the result of a http.request(), so that multiple requests run serially?

Assume there is a function doRequest(options), which is supposed to perform an HTTP request and uses http.request() for that. If doRequest() is called in a loop, I want that the next request is made after the previous finished (serial execution, one after another). In order to not mess with callbacks and Promises, I want to […]

Electron loading animation

Could someone please help me to implement a loading animation for my Electron app ? I am learning this new technology and it would be nice to understand the correct way to do that. I am thinking about something like : app.on(‘ready’, () => { // show main content }) app.on(‘not-ready’, () => { // […]

How do I add an action to watson conversation response?

I’ve created intent, entity and dialog without a problem. But right now I’m trying to make it so when the user send “goodbye”, the application would close. According to the doc, I’ll have to name an action that goes along with an intent. How do I do that? Is it through code or through the […]

What is the difference between linking stylesheets and requiring them in Webpack + VueJs?

Using the VueJs and Webpack combo I have figured out that to include external stylesheets (for example bootstrap) you can do one of two things: In your main js script you could require the stylesheet like this: require(‘./assets/lib/bootstrap.min.css’); Or you could simply move it to a static folder accessed via Express and link it in […]

Sequelize.op is not defined

I’m using sequelize with Node.js. I’m trying to use Sequelize.op request. But it doesn’t work, this is my code : var Sequelize = require(‘sequelize’); const Op = Sequelize.Op; const operatorsAliases = { $eq: Op.eq } This is the error in the node console : Do you have any idea ? Thank you

How does a Node.js MVC work?

I’m really interested in systems written in node.js. Specifically using it to create an MVC application. I was thinking about the differences between designing a node.js MVC and doing the same in PHP. Since PHP is loaded and interpreted at runtime, a change to one of my controllers or views will be reflected in live […]

Node.js limitations of port and number

Why can’t I use port 80 in node.js? Also what are the rules of ports and ip addresses when I call the listen function in node.js. which ones are allowed and why? var http = require(‘http’); http.createServer(function (req, res) { res.writeHead(200, {‘Content-Type’: ‘text/plain’}); res.end(‘Yo’); }).listen(80, “127.0.0.1”); Thanks!!!

variable name for require'ing a module and jslint

I’ve just started to play around with nodejs and came across jslint, so I decided to test my code using this: jslint module for nodejs. I have 2 questions: 1.- Take for example this snippet: var util = require(‘util’); when running jslint like: jslint –indent 4 –white –regexp –goodparts file.js it will produce: /*jslint indent: […]

Error installing NPM for node.js

I’m trying to install npm on ubuntu 11.04 using the “git all the way” method found in this gist I keep getting this error after running sudo make install on npm $ sudo make install ! [ -d .git ] || git submodule update –init –recursive node cli.js install -g -f bash: node: command not […]

nodejs mustache/handlebars example project

I’ve been looking to use mustache or handlebars and nodejs but I have’t been successful to finding a sample project online that is working. I just need a sample skeleton structure which uses mustache as a templating engine. My goal is to use nodejs, mustache/handlebars, less (css framework) and some good routing but haven’t been […]

Node.js is the Best Javascript runtime in the world.