const fs = require('fs');
fs.readFile('./file/lorem.txt', (err, data) => {
if ( err) throw err;
console.log(data.toString());
})
coding with ☕️
https://youtu.be/f2EqECiTBL8?si=3cTRK7yFrqDmFmt6
I promise I will end this video in several days
7:00:01 now I ve finished only 24 minutescoding with ☕️ pinned «I promise I will end this video in several days 7:00:01 now I ve finished only 24 minutes»
Nest.jst ,Express.js, Node.js, MongoDB ,PosterSQL, ,MySQL, Koa.js, Fastify
const fs = require("fs");
const path = require("path");
fs.readFile(
path.join(__dirname, "files", "starter.txt"),
"utf8",
(err, data) => {
if (err) throw err;
console.log(data);
}
);
console.log("Hello...");
fs.writeFile(
path.join(__dirname, "files", "reply.txt"),
"Nice to meet you.",
(err) => {
if (err) throw err;
console.log("Write complete");
fs.appendFile(
path.join(__dirname, "files", "reply.txt"),
"\n\nYes it is. ",
(err) => {
if (err) throw err;
console.log("Append complete");
fs.rename(
path.join(__dirname, "files", "reply.txt"), path.join(__dirname, 'files', 'newReply.txt'),
(err) => {
if (err) throw err;
console.log("Rename complete");
}
);
}
);
}
);
coding with ☕️
https://youtu.be/f2EqECiTBL8?si=3cTRK7yFrqDmFmt6
1:00 hour completedvar nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'youremail@gmail.com',
pass: 'yourpassword'
}
});
var mailOptions = {
from: 'youremail@gmail.com',
to: 'myfriend@yahoo.com',
subject: 'Sending Email using Node.js',
text: 'That was easy!'
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});