Difference between req.url and req.originalUrl in Express.js version 4

From the Express.js documentation: req.url is not a native Express property, it is inherited from Node’s http module. This property is much like req.url; however, it retains the original request URL, allowing you to rewrite req.url freely for internal routing purposes. For example, the “mounting” feature of app.use() will rewrite req.url to strip the mount … Read more

Reference file in public folder from CSS in create-react-app

Just use a / before the name, this will make it relative to the output root, which includes anything in the public folder (provided the finished hosted application is served at the root of a domain). so for the question asked above: .App-header { background-color: #222; height: 150px; padding: 20px; color: white; background-image: url(“/example.png”); } … Read more

What could cause “connect ETIMEDOUT” error when the URL is working in browser?

When behind a proxy you need to make the following modifications (as explained in this answer): put the proxy host in the host parameter put the proxy port in the port parameter put the full destination URL in the path parameter : Which gives: var options = { host: ‘<PROXY_HOST>’, port: ‘<PROXY_PORT>’, path: ‘http://www.boardgamegeek.com/xmlapi/boardgame/1?stats=1’, method: … Read more

node.js – handling TCP socket error ECONNREFUSED

I ran the following code: var net = require(‘net’); var client = net.connect(5558, ‘localhost’, function() { console.log(“bla”); }); client.on(‘error’, function(ex) { console.log(“handled error”); console.log(ex); }); As I do not have 5558 open, the output was: $ node test.js handled error { [Error: connect ECONNREFUSED] code: ‘ECONNREFUSED’, errno: ‘ECONNREFUSED’, syscall: ‘connect’ } This proves that the … Read more