6 changed files with 44 additions and 0 deletions
@ -0,0 +1 @@ |
|||
console.log("Hello World! from 01.js file") |
@ -0,0 +1,4 @@ |
|||
//node 02.js Jan
|
|||
//node <nazev> <arg[2]> <arg[3]> ....
|
|||
//<arg[0]> <arg[1]> <arg[2]> <arg[3]> ....
|
|||
console.log("Ahoj:", process.argv[2]) |
@ -0,0 +1,12 @@ |
|||
const fs = require("fs"); |
|||
|
|||
const obsah = "Toto je text z NodeJS skriptu"; |
|||
|
|||
fs.appendFile("pozdrav.txt",obsah, (err) => { |
|||
if(err) { |
|||
console.error(err) |
|||
return |
|||
} |
|||
console.log("Soubor by měl byt zapsan") |
|||
}); |
|||
|
@ -0,0 +1,12 @@ |
|||
const fs = require("fs"); |
|||
|
|||
fs.readFile("pozdrav.txt", "utf-8", (err,data) => { |
|||
if(err){ |
|||
console.error(err); |
|||
return; |
|||
} |
|||
console.log("Obsah souboru:"); |
|||
console.log(data); |
|||
}); |
|||
|
|||
console.log("Čekám na přečtení souboru...") |
@ -0,0 +1,14 @@ |
|||
const http = require("http"); |
|||
|
|||
const port = 3000; |
|||
|
|||
const server = http.createServer((req,res) => { |
|||
res.statusCode = 200; |
|||
res.setHeader("Content-Type", "text/plain: charset-utf-8"); |
|||
|
|||
res.end("Ahoj z meho prvního Node.JS serveru!\n"); |
|||
}) |
|||
|
|||
server.listen(port, "127.0.0.1", () => { |
|||
console.log(`Server beží na adrese http://localhost:${port}`) //AltGR+ý=`
|
|||
}) |
@ -0,0 +1 @@ |
|||
Toto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptuToto je text z NodeJS skriptu |
Loading…
Reference in new issue