DASHA
This commit is contained in:
		
							
								
								
									
										32
									
								
								Layout v Handlebars/app.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Layout v Handlebars/app.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| const express = require('express'); | ||||
| const expressHbs = require('express-handlebars'); | ||||
| const hbs = require('hbs'); | ||||
| const app = express(); | ||||
|  | ||||
| // устанавливаем настройки для файлов layout | ||||
| app.engine( | ||||
|     'hbs', | ||||
|     expressHbs.engine({ | ||||
|         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); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 User1
					User1