Full Node.
js Course Content
Full Node.js Course Content
1. Introduction to Node.js
Node.js is an open-source, cross-platform JavaScript runtime environment that allows you to run JavaScript
code on the server. It uses the V8 engine (from Chrome) and is known for its event-driven, non-blocking I/O
model.
Key Features:
- Single-threaded event loop
- Fast execution with V8
- Built-in modules (CommonJS)
- Package manager (npm)
Installation:
- Download from nodejs.org
- Verify: node -v, npm -v
REPL (Read-Eval-Print-Loop):
> node
>2+2
2. Node.js Core Modules
- http: Create a server
- fs: File system operations
- path: Path handling
- events: Event emitters
- os: System info
Full Node.js Course Content
Example (http):
const http = require('http');
http.createServer((req, res) => {
res.end('Hello, Node.js!');
}).listen(3000);
3. Working with Files
fs.readFile('file.txt', 'utf8', (err, data) => {
if (err) throw err;
console.log(data);
});
4. Creating a Web Server
const server = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World');
});
5. npm
npm init -y
npm install express
6. Express.js
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('Hello Express'));
app.listen(3000);
Full Node.js Course Content
7. APIs
app.get('/api', (req, res) => res.json({ message: 'API working' }));
8. Database
MongoDB with Mongoose:
mongoose.connect('mongodb://localhost:27017/shop');
9. Auth & Security
JWT, bcrypt, helmet, cors, dotenv
10. Async Programming
Use of callbacks, Promises, and async/await
11. Testing
Use Jest:
test('sum test', () => expect(sum(1,2)).toBe(3));
12. Deployment
Use pm2 for production, and deploy to Render, Railway, or VPS.
Sample Code:
const http = require('http');
http.createServer((req, res) => {
Full Node.js Course Content
res.end('Hello, Node.js!');
}).listen(3000);