Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
47651a6
10-fs-sync.js
canilo1 Mar 29, 2025
90cc19f
11-fs-async.js
canilo1 Mar 29, 2025
8d0ea67
Prompter.js
canilo1 Mar 29, 2025
c169fd7
First file writewithPromise
canilo1 Apr 5, 2025
dfde091
Created writeWIthPromisesThen.js
canilo1 Apr 5, 2025
5585842
CustomEmitter.js
canilo1 Apr 5, 2025
e256f90
16-stream.js
canilo1 Apr 5, 2025
e9133fc
Merge pull request #1 from canilo1/FirstWeek
canilo1 Apr 16, 2025
11bc54d
Merge pull request #2 from canilo1/week2
canilo1 Apr 16, 2025
2d84dd0
Your commit message
canilo1 Apr 16, 2025
50eb914
Logger
canilo1 Apr 27, 2025
d52ef9e
answers for lesson 1
canilo1 Nov 17, 2025
2ce878f
Merge branch 'main' into week1
canilo1 Nov 29, 2025
009ec21
Merge branch 'main' of https://github.com/canilo1/node-express-course…
canilo1 Dec 3, 2025
bdcf2cb
Merge branch 'week1' of https://github.com/canilo1/node-express-cours…
canilo1 Dec 3, 2025
a54900a
Finished week2
canilo1 Dec 3, 2025
c1cf70f
Merge pull request #7 from canilo1/week2
canilo1 Dec 11, 2025
cd2a966
Finished week2
canilo1 Dec 3, 2025
952a979
Merge branch 'main' of https://github.com/canilo1/node-express-course…
canilo1 Dec 14, 2025
110f8a0
Merge pull request #8 from canilo1/week3
canilo1 Dec 18, 2025
af119d0
week4
canilo1 Dec 18, 2025
e24c563
Merge branch 'main' of https://github.com/canilo1/node-express-course…
canilo1 Dec 18, 2025
10d6255
Merge pull request #9 from canilo1/week4
canilo1 Jan 3, 2026
21a84d9
week5
canilo1 Jan 3, 2026
eb8838d
Merge pull request #10 from canilo1/week5
canilo1 Jan 12, 2026
8d3a74a
week6
canilo1 Jan 13, 2026
225de9b
Merge pull request #11 from canilo1/week6
canilo1 Jan 17, 2026
e158e60
QueryParams
canilo1 Jan 18, 2026
85ad149
Merge pull request #12 from canilo1/week7
canilo1 Jan 29, 2026
8c2be3b
JWT BASICS
canilo1 Jan 29, 2026
66da7fe
Jobs APi
canilo1 Jan 30, 2026
02823ed
Jobs api part 2
canilo1 Feb 3, 2026
922e529
Merge pull request #15 from canilo1/jobsapi2week10
canilo1 Feb 13, 2026
2c6feb8
Merge pull request #14 from canilo1/jobsapiweek9
canilo1 Feb 16, 2026
3108aff
Finished
canilo1 Feb 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion 01-node-tutorial/02-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// module - info about current module (file)
// process - info about env where the program is being executed

console.log(__dirname)
setInterval(() => {
console.log('hello world')
}, 1000)
console.log('__dirname:', __dirname);
console.log('process.env.MY_VAR:', process.env.MY_VAR);
console.log('__filename:', __filename);
1 change: 1 addition & 0 deletions 01-node-tutorial/03-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ require('./07-mind-grenade')
sayHi('susan')
sayHi(names.john)
sayHi(names.peter)
console.log(data)
7 changes: 6 additions & 1 deletion 01-node-tutorial/10-fs-sync.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { readFileSync, writeFileSync } = require('fs')
const { readFileSync, writeFileSync, write, writeFile, readFile } = require('fs')
console.log('start')
const first = readFileSync('./content/first.txt', 'utf8')
const second = readFileSync('./content/second.txt', 'utf8')
Expand All @@ -8,5 +8,10 @@ writeFileSync(
`Here is the result : ${first}, ${second}`,
{ flag: 'a' }
)
writeFileSync('./answers/temporary/fileA.txt',"Testing this",{flag:'a'})
writeFileSync('./answers/temporary/fileA.txt',"Testing t23his",{flag:'a'})
writeFileSync('./answers/temporary/fileA.txt',"Testing t2123his",{flag:'a'})
const readingFIleA = readFileSync('./answers/temporary/fileA.txt','utf8')
console.log(readingFIleA)
console.log('done with this task')
console.log('starting the next one')
39 changes: 38 additions & 1 deletion 01-node-tutorial/11-fs-async.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { readFile, writeFile } = require('fs')
const { readFile, writeFile, write, writeFileSync } = require('fs')

console.log('start')
readFile('./content/first.txt', 'utf8', (err, result) => {
Expand Down Expand Up @@ -27,3 +27,40 @@ readFile('./content/first.txt', 'utf8', (err, result) => {
})
})
console.log('starting next task')

readFile('./answers/temporary/fileB.txt','utf8',(err,result)=> {
if(err){
console.log("The file was not read OH NOO",err)
return
}else{
const firstGrocery = result
writeFileSync('./answers/temporary/fileB.txt',"Pizza 10.25$",(err,result)=>{
if(err){
console.log(err)
return
}
console.log("Finnaly wrote the first grocery")
})
const secondGrocery = result
writeFileSync('./answers/temporary/fileB.txt',"Lemons 20.30$",(err,result)=>{
if(err){
console.log(err)
return
}
console.log("Finnaly wrote teh second grocery")

})
const thirdGrocery = result
writeFileSync('./answers/temporary/fileB.txt',"Potato 20.30$",(err,result)=>{
if(err){
console.log(err)
return
}
console.log("Finnaly wrote teh second grocery")

})


}
})
console.log("This is the end")
22 changes: 11 additions & 11 deletions 01-node-tutorial/12-http.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const http = require('http')

const server = http.createServer((req, res) => {
// if (req.url === '/') {
// res.end('Welcome to our home page')
// }
// if (req.url === '/about') {
// res.end('Here is our short history')
// }
// res.end(`
// <h1>Oops!</h1>
// <p>We can't seem to find the page you are looking for</p>
// <a href="/">back home</a>
// `)
if (req.url === '/') {
res.end('Welcome to our home page')
}
if (req.url === '/about') {
res.end('Here is our short history')
}
res.end(`
<h1>Oops!</h1>
<p>We can't seem to find the page you are looking for</p>
<a href="/">back home</a>
`)
// ###################################
// ###################################
//
Expand Down
3 changes: 3 additions & 0 deletions 01-node-tutorial/answers/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
.DS_Store
temp.txt
32 changes: 32 additions & 0 deletions 01-node-tutorial/answers/16-stream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { createReadStream } = require("fs");
const path = require("path");

// Create the path to the big file
const filePath = path.join(__dirname, "../content/big.txt");

// Create the read stream with encoding and highWaterMark
const stream = createReadStream(filePath, {
encoding: "utf8",
highWaterMark: 200 // You will change this number to test later
});

let counter = 0;

// Handle data event
stream.on("data", (chunk) => {
counter++;
console.log(`Chunk #${counter}:`);
console.log(chunk);
console.log("--------------------------------------------------");
});

// Handle end event
stream.on("end", () => {
console.log(`\nFinished reading file.`);
console.log(`Total chunks received: ${counter}`);
});

// Handle error event
stream.on("error", (err) => {
console.error("Error:", err);
});
6 changes: 6 additions & 0 deletions 01-node-tutorial/answers/customEmitter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const EventEmitter = require("events");
const emitter = new EventEmitter();
setInterval(() => {
emitter.emit("timer", "hi there");
}, 2000);
emitter.on("timer", (msg) => console.log(msg));
Loading