DeveloperBreeze

Hashing Password with SHA-256 using 'crypto' module

// Import 'crypto' module
const crypto = require('crypto');

// Example password
const password = 'mypassword';

// Create SHA-256 hash of the password
const hash = crypto.createHash('sha256').update(password).digest('hex');

// Log the generated hash
console.log('Hash:', hash);

Continue Reading

Discover more amazing content handpicked just for you

Tutorial

Build a Custom Rate Limiter in Node.js with Redis

Have questions or want a follow-up tutorial? Leave a comment or reach out—we’d love to help.

🔗 More practical Node.js guides →

Apr 04, 2025
Read More
Tutorial
javascript css +1

Building a Real-Time Chat Application with WebSockets in Node.js

node server.js

http://localhost:3000/

Aug 03, 2024
Read More
Code
php

JWT Token Creation and Verification in Node.js using 'jsonwebtoken'

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Simple HTTP Server in Node.js

// Import 'http' module
const http = require('http');

// Create a simple HTTP server
const server = http.createServer((req, res) => {
  res.end('Hello, Node.js!');
});

// Start the server and listen on port 3000
server.listen(3000, () => {
  console.log('Server is listening on port 3000');
});

Jan 26, 2024
Read More
Code
javascript

Read and Write Files in Node.js using 'fs' module

// Import 'fs' module
const fs = require('fs');

// Read a file
fs.readFile('file.txt', 'utf8', (err, data) => {
  if (err) throw err;
  console.log(data);
});

// Write to a file
fs.writeFile('newfile.txt', 'Hello, Node.js!', (err) => {
  if (err) throw err;
  console.log('File written successfully.');
});

Jan 26, 2024
Read More
Code
javascript

Simple RESTful API in Node.js using Express

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Date Manipulation and Sum Calculation

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Access Command-line Arguments

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Set and Access Environment Variable

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Event Emitter using 'events' module

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Construct File Path using 'path' module

// Import 'path' module
const path = require('path');

// Construct a file path using 'path.join'
const filePath = path.join(__dirname, 'files', 'example.txt');

// Log the generated file path
console.log('File Path:', filePath);

Jan 26, 2024
Read More
Code
javascript

Basic Authentication using 'express-basic-auth' middleware

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Create and Print Buffer

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Parse URL and Query Parameters

// Import 'url' and 'querystring' modules
const url = require('url');
const querystring = require('querystring');

// Example request URL
const requestUrl = 'http://example.com/api?param1=value1&param2=value2';

// Parse the URL
const parsedUrl = url.parse(requestUrl);

// Parse and retrieve query parameters
const queryParams = querystring.parse(parsedUrl.query);

// Log the parsed query parameters
console.log('Query Parameters:', queryParams);

Jan 26, 2024
Read More
Code
javascript

Execute Shell Command using 'child_process' module

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

File Stream Copy using 'fs' module

No preview available for this content.

Jan 26, 2024
Read More
Code
javascript

Simple WebSocket Server using 'ws' library

No preview available for this content.

Jan 26, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!