final
This commit is contained in:
		
							
								
								
									
										30
									
								
								task29/app.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								task29/app.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| const express = require('express'); | ||||
| const expressHbs = require('express-handlebars'); | ||||
| const hbs = require('hbs'); | ||||
| const app = express(); | ||||
|  | ||||
| // устанавливаем настройки для файлов layout | ||||
| app.engine( | ||||
|     'hbs', | ||||
|     expressHbs({ | ||||
|         layoutsDir: 'views/layouts', | ||||
|         defaultLayout: 'layout', | ||||
|         extname: 'hbs', | ||||
|     }) | ||||
| ); | ||||
| app.set('view engine', 'hbs'); | ||||
| hbs.registerPartials(__dirname + '/views/partials'); | ||||
|  | ||||
| app.use('/contact', function (request, response) { | ||||
|     response.render('contact', { | ||||
|         title: 'Мои контакты', | ||||
|         emailsVisible: true, | ||||
|         emails: ['gavgav@mycorp.com', 'mioaw@mycorp.com'], | ||||
|         phone: '+1234567890', | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| app.use('/', function (request, response) { | ||||
|     response.render('home.hbs'); | ||||
| }); | ||||
| app.listen(3000); | ||||
							
								
								
									
										1145
									
								
								task29/package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										1145
									
								
								task29/package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										9
									
								
								task29/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								task29/package.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|     "name": "expressapp", | ||||
|     "version": "1.0.0", | ||||
|     "dependencies": { | ||||
|         "express": "^4.18.2", | ||||
|         "express-handlebars": "^7.1.2", | ||||
|         "hbs": "^4.2.0" | ||||
|     } | ||||
| } | ||||
							
								
								
									
										3
									
								
								task29/views/contact.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								task29/views/contact.hbs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| <h1>{{title}}</h1> | ||||
| <p>Электронный адрес: {{email}}</p> | ||||
| <p>Телефон: {{phone}}</p> | ||||
							
								
								
									
										1
									
								
								task29/views/home.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								task29/views/home.hbs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <h1>Главная страница</h1> | ||||
							
								
								
									
										14
									
								
								task29/views/layouts/layouts.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								task29/views/layouts/layouts.hbs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| <!DOCTYPE html> | ||||
| <html> | ||||
| <head> | ||||
|     <title>{{title}}</title> | ||||
|     <meta charset="utf-8" /> | ||||
| </head> | ||||
| <body> | ||||
|     {{> menu}} | ||||
|  | ||||
|     {{{body}}} | ||||
|  | ||||
|     {{> footer}} | ||||
| </body> | ||||
| <html> | ||||
							
								
								
									
										1
									
								
								task29/views/partials/footer.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								task29/views/partials/footer.hbs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <footer><p>MyCorp - Copyright © 2017</p></footer> | ||||
							
								
								
									
										4
									
								
								task29/views/partials/menu.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								task29/views/partials/menu.hbs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| <nav> | ||||
|     <a href="/">Главная</a> | | ||||
|     <a href="/contact">Контакты</a> | ||||
| </nav> | ||||
		Reference in New Issue
	
	Block a user
	 kogleee
					kogleee