diff --git a/notes_hugo.md b/notes_hugo.md index a24708a8..55e19480 100644 --- a/notes_hugo.md +++ b/notes_hugo.md @@ -1,4 +1,23 @@ ## node.js & postgresql -- https://www.youtube.com/watch?v=ufdHsFClAk0 +- [youtube tuto js + postgresql](https://www.youtube.com/watch?v=ufdHsFClAk0) +- [node.js wikipedia](https://en.wikipedia.org/wiki/Node.js) +- node.js is originally a replacement to the web server apache +- [youtube tuto nodejs fr](https://www.youtube.com/watch?v=0PA69L88HeI) + +code synchrone / asynchrone : +``` +// bocking code +var content = fs.readFileSync('MyFile.txt'); +console.log('my file :', content); + +// non-bocking code +fs.readFile('MyFile.txt', (err, content) => { + if (err) { + throw err; + } + console.log('my file :', content); +}); +``` +- [doc technos generic](https://devdocs.io/) diff --git a/tests/tests_hugo/index.html b/tests/tests_hugo/index.html new file mode 100644 index 00000000..4bdda0a2 --- /dev/null +++ b/tests/tests_hugo/index.html @@ -0,0 +1,9 @@ + + + + my title + + +

my page

+ + diff --git a/tests/tests_hugo/server.js b/tests/tests_hugo/server.js new file mode 100644 index 00000000..66ec27e2 --- /dev/null +++ b/tests/tests_hugo/server.js @@ -0,0 +1,25 @@ +// console.log('salut') +let http = require('http') +let fs = require('fs') + +let server = http.createServer() + +server.on('request', (request, response) => { + +// fs.readFile('index.html', (err, data) => { +// if (err) { +// response.writeHead(404) +// response.end('file not found') +// } +// else { +// response.writeHead(200, { +// 'content-type': 'text/html; charset=utf-8' +// }) +// response.end('salut comment ca va') +// } +// }) + +}) + +server.listen('8080') +