You can create your own modules, and easily include them in your applications.
The following example creates a module that returns a date and time object
source Code 👇👇👇👇
_______________
myfirstfile.js
exports.myDateTime = function () {
return Date();
};
finalfile.js
const http = require('http');
const dt = require('./myfirstfile');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write("The date and time are currently: " + dt.myDateTime());
res.end();
}).listen(8080);
_______________
Playlist 👇👇👇👇👇
Htpp Module in node js: • Http Module in node js
Node js complete course in termux: • Node js complete course in termux
Learn fs js in in termux explained: • Learn fs js in in termux explained
Termux Tutorial: • Termux Tutorial
Termux Full-Course: • Termux Full-Course
Termux Full-Course: • Termux Full-Course
Bash Script: • Bash Script
OS Instillation: • OS Instillation
AIDE-IDE-for-Android-Java/android studio Apps: • AIDE-IDE-for-Android-Java/android stu...
Software Install: • Software Install
Tips and tricks: • Tips and tricks
Requested Videos: • Requested Videos
Recycler View: • Recycler View
Learn Python For free Hindi/Urdu: • Learn Python For free Hindi/Urdu
FireBase Apps: • FireBase Apps
Fragment: • Fragment
Android Studio Erorr Fix: • Android Studio Erorr Fix