How, in general, does Node.js handle 10,000 concurrent requests?

If you have to ask this question then you’re probably unfamiliar with what most web applications/services do. You’re probably thinking that all software do this: user do an action │ v application start processing action └──> loop … └──> busy processing end loop └──> send result to user However, this is not how web applications, … Read more

Differences between socket.io and websockets

Misconceptions There are few common misconceptions regarding WebSocket and Socket.IO: The first misconception is that using Socket.IO is significantly easier than using WebSocket which doesn’t seem to be the case. See examples below. The second misconception is that WebSocket is not widely supported in the browsers. See below for more info. The third misconception is … Read more

How to access the GET parameters after “?” in Express?

So, after checking out the express reference, I found that req.query.color would return me the value I’m looking for. req.params refers to items with a ‘:’ in the URL and req.query refers to items associated with the ‘?’ Example: GET /something?color1=red&color2=blue Then in express, the handler: app.get(‘/something’, (req, res) => { req.query.color1 === ‘red’ // … Read more

Local dependency in package.json

npm >= 2.0.0 This feature was implemented in the version 2.0.0 of npm. Local paths can be saved using npm install -S or npm install –save, using any of these forms: ../foo/bar ~/foo/bar ./foo/bar /foo/bar Example package.json: { “name”: “baz”, “dependencies”: { “bar”: “file:../foo/bar” } } npm ls: app@0.0.1 /private/tmp/app └── somelocallib@0.0.1 -> /private/tmp/somelocallib npm … Read more

What is Node.js’ Connect, Express and “middleware”?

[Update: As of its 4.0 release, Express no longer uses Connect. However, Express is still compatible with middleware written for Connect. My original answer is below.] I’m glad you asked about this, because it’s definitely a common point of confusion for folks looking at Node.js. Here’s my best shot at explaining it: Node.js itself offers … Read more

bodyParser is deprecated express 4

It means that using the bodyParser() constructor has been deprecated, as of 2014-06-19. app.use(bodyParser()); //Now deprecated You now need to call the methods separately app.use(bodyParser.urlencoded()); app.use(bodyParser.json()); And so on. If you’re still getting a warning with urlencoded you need to use app.use(bodyParser.urlencoded({ extended: true })); The extended config object key now needs to be explicitly … Read more

How to use executables from a package installed locally in node_modules?

UPDATE: As Seyeong Jeong points out in their answer below, since npm 5.2.0 you can use npx [command], which is more convenient. OLD ANSWER for versions before 5.2.0: The problem with putting ./node_modules/.bin into your PATH is that it only works when your current working directory is the root of your project directory structure (i.e. … Read more

Node Sass couldn’t find a binding for your current environment

I had the same problem There is an error in your gulpfile: Error: Missing binding E:\allapp\badshaindiancuisine\node_module\node-sass\vendor\win32-x64-46\binding.node Node Sass could not find a binding for your current environment:Windows 64-bit with Node.js 4.x Found bindings for the following environment:     – OS X 64-bit with Node.js 4.x How to solve the problem By going into the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)