Node server fails to listen to public IP

I am trying to get my Node.js server to listen to a public IP so that I can access it on a different network than my home network.I've purchased a domain and used a DNS host - right now I'm using No-IP and have downloaded their client to push my IP to their servers.When I set the IP on No-IP configuration to my local IP I can use the domain name and hit my server on another computer on my network. But if I change this to my public IP and use the domain, the request hangs for about 10 seconds and then fails. I've set up port forwarding (I believe correctly) and opened inbo...

How can I update nodejs version in laragon?

I use laragon for many thing. It's an awesome software. However, nodejs version is old. How can I update nodejs version in laragon? Thank you for your valuable time. I got it. All I needed to replace the old version with new version.You need make sure that you are installing the new version in 'C:\laragon\bin\nodejs'. Hope it may helps others. [XXX]

VSTS Default Agent build fails angular 5 App

I am trying to build angular 5 App on VSTS default agent, but it fails. I used hosted agent it show version error saying it's not up to date. Is there any way to do this.2018-01-01T19:04:36.3676392Z 17 error Windows_NT 6.3.96002018-01-01T19:04:36.3676620Z 18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" "--prod"2018-01-01T19:04:36.3676866Z 19 error node v6.9.12018-01-01T19:04:36.3677050Z 20 error npm v3.10.82018-01-01T19:04:36.3677231Z 21 error code ELIFECYCLE2018-01-01T19:04:36.3677432Z 22 er...

ClaudiaJS and pg-pool: how to wrap in promise

I use ClaudiaJS to deploy the serverless API (Lambda + API Gateway). In my API, I access to RDS Postgres using pg-pool.What I have done:In app.jsvar ApiBuilder = require('claudia-api-builder'),api = new ApiBuilder();module.exports = api;var Pool = require('pg-pool');api.get("/list", function (request) { var dbconnect = { user: ‘xxxx’, //env var: PGUSER database: ‘xxxx’, //env var: PGDATABASE password: ‘xxx’, //env var: PGPASSWORD host: ‘xxxxxxxxxx.eu-west-1.rds.amazonaws.com', // Server hosting the postgres database port: 5432, //env var: PGPORT ma...

Download an image using node-request, and fs Promisified, with no pipe in Node.js

I have been struggling to succeed in downloading an image without piping it to fs. Here's what I have accomplished:var Promise = require('bluebird'), fs = Promise.promisifyAll(require('fs')), requestAsync = Promise.promisify(require('request'));function downloadImage(uri, filename){ return requestAsync(uri) .spread(function (response, body) { if (response.statusCode != 200) return Promise.resolve(); return fs.writeFileAsync(filename, body); }) .then(function () { ... }) // ...}A valid input might be:downloadImage('htt...

Error installing SailsJS in OpenShift

info: Starting app...Grunt :: module.js:340 throw err; ^Error: Cannot find module '/var/lib/openshift/54a3a0ec4382ecf1130000f1/app-root/runtime/repo/node_modules/sails/node_modules/grunt-cli/bin/grunt' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3 OpenShift needs grunt separately added to package.json, it does not contain it out of box.Try to add the following there to get grunt working: "dependencies...

How to use Let's Encrypt with Docker container based on the Node.js image

I am running an Express-based website in a Docker container based on the Node.js image. How do I use Let's Encrypt with a container based on that image? The first thing I've done is to create a simple express-based docker image.I am using the following app.js, taken from express's hello world example in their docs:var express = require('express');var app = express();app.get('/', function (req, res) { res.send('Hello World!');});app.listen(3000, function () { console.log('Example app listening on port 3000!');});I also ended up with the following packages.json file afte...

How to return a value from a function that uses 'http.get()' method in Node.js?

I have a simple HTTP GET function that only needs to return the response in a function, but right now this function is returning void.The code in sitechecks.jsvar checkSite = () => { https.get('https://itmagazin.info', (res, err) => { if (res.statusCode === 200 && res.statusMessage === 'OK') { return `The site returned: ${res.statusMessage}` } else return `Error, the site returned: ${err.message}` })}module.exports = checkSiteAnd when I import the module in index.js, the console returns [Function: checkSite] and not the value its...

Getting error while running gulp from cmd in laravel application

while running gulp from cmdmodule.js:328 throw err; ^ Error: Cannot find module 'dateformat' at Function.Module._resolveFilename (module.js:326:15) at Function.Module._load (module.js:277:25) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (...

Issues with dynamodb query with KeyConditionExpression

Trying to use KeyConditionExpression as per the dynamodb api document using nodejs sdk. KeyConditionExpression is not supported with nodejs SDK.Here is what i didCreated a Table with Hash and Range.Table : TABLE1Hash Attribute Name : Provider ( String) Range Attribute Key : ScheduledEndTime ( Number ) // In Milli SecondsHere is payload to trigger dynamo DB query:{ TableName: 'TABLE1', ConsistentRead: true, Select: "ALL_ATTRIBUTES", KeyConditionExpression: 'Provider = :v_provider AND ScheduledEndTime > :v_scheduledEndTime', ExpressionAttributeValues: { ":v_provid...

Get request's first response status code

I am requesting example.com than it redirects me to www.example.com with 301 or 302 status and then I get response from www.example.com with code 200. I want to get all statuses not only the last. I use 'request' module in my node server.Here is my code app.post("/check", function(req, res) { var link = req.body.url; var opts = { uri: link, gzip: true, followRedirect :function (resp) { return true; } }; request(opts, function (error, res, body) { if (res.statusCode > 300 && res.statusCode < 400 && res.headers.location) { ...

express - nodejs - Keep URL if in a subdomain instead of redirecting

My current set up is such that http://test.com/project points to some root index view.Using this gist, I have it so that http://mysubdomain.test.com redirects to the aforementioned url.This is okay, but ideally I would like it such that the subdomain stayed in tact. I have not found a way to redirect while keeping the URL the same. redirect means go to another URL. there's no way to keep the original url. The only way to keep it is to map the subdomain on same route OR use parameter/regex in subdomain name. Express fully allows for that: app.get('/:subdomain.test.com/' o...

Using VHOST for subdomains on Express

I have 2 separated site (static web and application). I've tried to use Express vhost middleware but I couldn't manage.For the below codes I configured my hosts file as;127.0.0.1 localhost127.0.0.1 process.localhostmy server.js codesvar connect = require('connect')var express = require('express')var vhost = require('vhost')var app = require('./app')var static = require('./static')var server = connect()server.use(vhost('localhost', static.service)).use(vhost('process.localhost', app.service)).listen(1337, function(){ console.log('Server is listening')})Then if I write my ...

Is it necessary to call end() on a received http request in Node?

I have a Node server which can reject requests based upon security headers. If I reject a request, is it necessary to use blank data and end handlers to read the request body or can I just send the response, a 401, and leave the request unread?It seems that if I leave the response unread then I get occasional "The existing connection has been forcibly closed by the remote host" errors at the client. Adding code to wait for the request body to be read does seem to fix the issue but then again, adding delays at various points in the server code also seems to have a benefici...

ClojureScript + momentjs (node.js) fails with .format("dddd, MMMM Do YYYY, h:mm:ss a")

I'm trying to show current datetime format to console on node.js + clojure deploying momentjs .The working node js code:var moment = require("./lib/moment/moment.js");console.log(moment().format("dddd, MMMM Do YYYY, h:mm:ss a"));Console output:$ node app1 Friday, July 5th 2013, 9:57:07 amso, I tried a clojureScript code as below:(ns rxcljs.core (:use [cljs.nodejs :only [require]]))(def log #(.log js/console %))(def moment (require "./lib/moment/moment.js"))(->> (-> (moment) (.format "dddd, MMMM Do YYYY, h:mm:ss a") ) (log) ) The Co...

Error: Cannot find module 'less'

When running command: "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\dule\AppData\Local\Temp\ass2560.tmp" I got this error: Error Output: module.js:339 throw err; ^ Error: Cannot find module 'less' at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Module.require (module.js:366:17) at require (module.js:385:17) at Object. (C:\Users\dule\AppData\Local\Temp\ass2560.tmp:1:74) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) ...

Page 1 of 256  |  Show More Pages:  Top Prev Next Last