Install and use Node.js, npm, Socket.IO, React, Express
In this article, we will briefly describe the installation of Node.js , npm (Package Manager Node.js), Socket.IO , React and Express . Below we will show you the basic usage of Node.js for beginners.
Installation Node.js
Installation npm
Installation Socket.IO
Installation React
Installation Express
For example, create an app.js node.js script:
And we'll run it:
Now when we open http://localhost:5000 in the browser, we see "Hello World!".
By installing the screen package (for linux) and the nodemon module, we can automatically restart the node.js applications:
Finally, we roll the node.js application in the new screen using nodemon:
Put the shortcut ctrl+a+d to make the app.js node.js run in the background ...
Installation
Installation Node.js
apt install nodejsInstallation npm
apt install npmInstallation Socket.IO
npm install socket.ioInstallation React
npm install reactInstallation Express
npm install expressExample of using Node.js
For example, create an app.js node.js script:
vim app.js
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World!');
}).listen(5000);
console.log('We up at http://localhost:5000');
And we'll run it:
nodejs app.jsNow when we open http://localhost:5000 in the browser, we see "Hello World!".
Autostart node.js apps
By installing the screen package (for linux) and the nodemon module, we can automatically restart the node.js applications:
apt install screennpm install nodemonFinally, we roll the node.js application in the new screen using nodemon:
screennodemon app.jsPut the shortcut ctrl+a+d to make the app.js node.js run in the background ...