Write file in node js

var fs = require('fs'); //Replace the file with a new one: fs.writeFile('mynewfile3.txt', 'This is my text.', function (err) { if (err) throw err; console.log('Replaced!'); }); // You can write anything…

0 Comments

Create files in node js

var fs = require('fs'); //create a file named mynewfile1.txt: fs.appendFile('mynewfile1.txt', 'Hello content!', function (err) { if (err) throw err; console.log('Saved!'); }); After refress this file it is creating new file…

0 Comments

File system in node js ( Read file )

A. Create new file suppose read.html <form> <input type="text" name="" placeholder="Enter your name.."> </form>   B. In index.js var http = require('http'); var fs = require('fs'); http.createServer(function (req, res) {…

0 Comments

Create own module in node js

We can write anything as you want in my_module.js file. var http = require('http'); var dt = require('./my_module'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write("The date and time are…

0 Comments

Express js installation

Express.js tutorial provides basic and advanced concepts of Express.js. Our Express.js tutorial is designed for beginners and professionals both. Express.js is a web framework for Node.js. It is a fast,…

0 Comments

Dropdown menu

<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container mt-3"> <h2>Dropdowns</h2> <p>The .dropdown class is used to…

0 Comments