Are there any good resources to get started with Node.JS? Any good tutorials, blogs or books?
Of course, I have visited its official website but I didn't think the documentation they have is a good starting point.
Are there any good resources to get started with Node.JS? Any good tutorials, blogs or books?
Of course, I have visited its official website but I didn't think the documentation they have is a good starting point.
For — helpful starter replies are already here: pointed toward interactive learning, gave a quick hands-on way to run Node locally, and demonstrated how a simple web route ties into an HTML view. Below are concise, modern next steps and a few traps to avoid so the thread stays useful years from now.
First practical step: manage Node versions with a version manager instead of a single global install. On macOS/Linux use nvm; on Windows use the nvm-for-Windows distribution — both let you switch safely between LTS and current releases and avoid PATH conflicts. (github.com) Pick an actively supported LTS for day-to-day work (better compatibility and security). (github.com)
What to learn first: focus on the core Node concepts (event loop, streams, buffers, and the built-in modules) and modern async patterns (Promises + async/await) instead of deep callback nesting. That shift alone makes code easier to read, test, and debug. (developer.mozilla.org) Keep first projects tiny — a CLI tool, a simple REST endpoint, or a file watcher — and use environment variables for runtime settings (for example process.env.PORT || 3000) so you do not have to manually change ports when you run multiple servers.
Make tooling part of the workflow early: add linting and automated tests before features accumulate — ESLint integrates into editors and CI and prevents many common bugs. (eslint.org) When ready to deploy, use a process manager and health checks, avoid blocking the event loop, and follow a concise best-practices checklist for security, testing, and deployment (there are community-maintained best-practice guides that collect these patterns). (github.com)
If a quick win is needed: reproduce one of the examples from this thread locally, then refactor it to use a version manager, move the port to an env variable, and add a linter and one test. That sequence converts a toy into a repeatable project you can safely grow.
Jump to Post— cereal 1,524Hi, have you tried http://nodeschool.io/ ?
Here is how you can start in 10 minutes or less. (Windows)
1 - 3 minutes : download and install your flavor.
4 - 5 minutes : open command prompt assuming your installation is on windows and on c drive. cd to the nodejs directory
C:\>cd nodejs
hit enter and then type
C:\nodejs>node
>
let's exit for a moment by pressing ctrl + c twice to go back to nodejs directory.
6 - 10 minutes : create a new file test.js in C:\nodejs\test.js. Copy and paste codes below and save your changes.
console.log("Welcome to my first NodeJs Program");
go back to your terminal and type
C:\nodejs>node test.js
hit enter and you should get something like this
C:\nodejs>node test.js
Welcome to my first NodeJs Program
In addition to cereal's recommendation read this great . Read the Doing Something Useful - HTTP Server paragraph.
Once you have immersed with the syntax, try reading Doing Something Useful - Express it is about the express framework. Make sure to always follow these and you won't get lost.
Practice and read Pro Node.Js for Developers from Appress written by Colin J Ihrig, Andy Ihrig.
I want to add
if you follow the tutorial, You need to change the port number
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8080);
console.log('Server running on port 8080.');
Just change the 8080 to something different to prevent any conflict with WAMP, XAMPP, UNIZero and others.
test on port 9999, then type on your browser http://localhost:9999. By setting it up like this you can still use the http://localhost/ for your PHP server.
This is how I set my development servers Apache port 80; Nodjs port 92; Python port 95
First, you must intall Node.js. After that, you create a new JS file, and put this in it...
var app = require('express')();
var http = require('http').Server(app);
app.get('/', function(req, res) {
res.sendFile(__dirname + '/chat.html');
});
http.listen(3000, function() {
console.log("Loaded!");
});
Then, you must create an HTML file to be displayed.
<html>
<head>
<title>Views</title>
</head>
<style>
#msgs {list-style-type: none; background: #99CCFF}
</style>
<body>
<center>
<ul id="msgs"></ul>
</center>
</body>
</html>
Once you have done that, you are all set to run it. To run it, you must open your command prompt, then go to the directory where you stored the JS file. After this, you must type in your command line, "node YOURFILENAME.js"
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.