Skip to content

Commit cfae0f8

Browse files
authored
Merge pull request #274 from pierangelomiceli/022_xmlhttp
XMLHttpRequest
2 parents 9303eb2 + 6acc2e9 commit cfae0f8

File tree

6 files changed

+178
-180
lines changed

6 files changed

+178
-180
lines changed

5-network/08-xmlhttprequest/article.md

Lines changed: 169 additions & 171 deletions
Large diffs are not rendered by default.

5-network/08-xmlhttprequest/example.view/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function accept(req, res) {
4343

4444

4545

46-
// ----- запуск accept как сервера из консоли или как модуля ------
46+
// ----- avvia il server ------
4747

4848
if (!module.parent) {
4949
http.createServer(accept).listen(8080);

5-network/08-xmlhttprequest/phones-async.view/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var file = new static.Server('.', {
1010
function accept(req, res) {
1111

1212
if (req.url == '/phones.json') {
13-
// искусственная задержка для наглядности
13+
// va un pochino in stallo per permettere di mostrare il messaggio di "loading"
1414
setTimeout(function() {
1515
file.serve(req, res);
1616
}, 2000);
@@ -21,7 +21,7 @@ function accept(req, res) {
2121
}
2222

2323

24-
// ------ запустить сервер -------
24+
// ------ avvia il server -------
2525

2626
if (!module.parent) {
2727
http.createServer(accept).listen(8080);

5-network/08-xmlhttprequest/phones.view/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
xhr.send();
1616

1717
if (xhr.status != 200) {
18-
// handle error
18+
// gestisce l'errore
1919
alert('Error ' + xhr.status + ': ' + xhr.statusText);
2020
} else {
21-
// show result
21+
// mostra il risultato
2222
alert(xhr.responseText);
2323
}
2424
}

5-network/08-xmlhttprequest/phones.view/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let file = new static.Server('.', {
1010
function accept(req, res) {
1111

1212
if (req.url == '/phones.json') {
13-
// stall a bit to let "loading" message show up
13+
// va un pochino in stallo per permettere di mostrare il messaggio di "loading"
1414
setTimeout(function() {
1515
file.serve(req, res);
1616
}, 2000);
@@ -21,7 +21,7 @@ function accept(req, res) {
2121
}
2222

2323

24-
// ------ запустить сервер -------
24+
// ------ avvia il server -------
2525

2626
if (!module.parent) {
2727
http.createServer(accept).listen(8080);

5-network/08-xmlhttprequest/post.view/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function accept(req, res) {
1717
chunks.push(data);
1818
length += data.length;
1919

20-
// More than 10mb, kill the connection!
20+
// Per un contenuto maggiore di 10mb, termina la connessione!
2121
if (length > 1e8) {
2222
req.connection.destroy();
2323
}
@@ -49,7 +49,7 @@ function accept(req, res) {
4949
}
5050

5151

52-
// ------ запустить сервер -------
52+
// ------ avvia il server -------
5353

5454
if (!module.parent) {
5555
http.createServer(accept).listen(8080);

0 commit comments

Comments
 (0)