update
This commit is contained in:
		
							
								
								
									
										19
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								app.js
									
									
									
									
									
								
							| @@ -1,9 +1,16 @@ | ||||
| const http = require('http'); | ||||
| const fs = require('fs'); | ||||
|  | ||||
| let message = 'Hello World!'; | ||||
| http.createServer(function (request, response) { | ||||
|     console.log(message); | ||||
|     response.end(message); | ||||
| }).listen(3000, '127.0.0.1', () => { | ||||
|     console.log('Сервер начал прослушивание запросов'); | ||||
| }); | ||||
|     fs.readFile('index.html', 'utf8', function ( | ||||
|         error, | ||||
|         data | ||||
|     ) { | ||||
|         let message = 'Изучаем Node.js'; | ||||
|         let header = 'Главная страница'; | ||||
|         data = data | ||||
|             .replace('{header}', header) | ||||
|             .replace('{message}', message); | ||||
|         response.end(data); | ||||
|     }); | ||||
| }).listen(3000); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Volodya
					Volodya