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);
}
});const { default: chalk } = require("chalk");
const printError = (error) => {
console.log('ERROR' + '' + message);
};
const printSucces = () => {};
module.exports = {
printError,
printSucces,
}const http = require('http');
const server = http.createServer((req, res) => {
res.statusCode = 200; // Status 200 => OK
res.setHeader('Content-Type', 'text/plain'); // Javob tipini belgilash
res.end('Hello, World!\n'); // Javobni yakunlash
});
server.listen(3000, () => {
console.log('Server 3000-portda ishlayapti');
});
coding with ☕️
const http = require('http'); const server = http.createServer((req, res) => { res.statusCode = 200; // Status 200 => OK res.setHeader('Content-Type', 'text/plain'); // Javob tipini belgilash res.end('Hello, World!\n'); // Javobni yakunlash }); se…
Application Programming Interface API - Module HTTPPlease open Telegram to view this post
VIEW IN TELEGRAM
🧭 Tavsiya: Qayerdan boshlash kerak?
Agar siz hozir http moduli va oddiy API yozishni o‘rganayotgan bo‘lsangiz:
🔹 1. Avval API (GET/POST/PUT/DELETE) asoslarini to‘liq tushunib oling.
🔹 2. Keyin Login/Signup, Token, Middlewareni o‘rganasiz.
🔹 3. So‘ngra Validatsiya, Paginatsiya, Deployment’ga o‘tasiz.
Agar siz hozir http moduli va oddiy API yozishni o‘rganayotgan bo‘lsangiz:
🔹 1. Avval API (GET/POST/PUT/DELETE) asoslarini to‘liq tushunib oling.
🔹 2. Keyin Login/Signup, Token, Middlewareni o‘rganasiz.
🔹 3. So‘ngra Validatsiya, Paginatsiya, Deployment’ga o‘tasiz.