DASHA
This commit is contained in:
19
Движок Pug/app.js
Normal file
19
Движок Pug/app.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.set('view engine', 'pug');
|
||||
|
||||
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.send('Главная страница');
|
||||
});
|
||||
app.listen(3000);
|
||||
1066
Движок Pug/package-lock.json
generated
Normal file
1066
Движок Pug/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
Движок Pug/package.json
Normal file
7
Движок Pug/package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"pub": "^0.2.0",
|
||||
"pug": "^3.0.2"
|
||||
}
|
||||
}
|
||||
21
Движок Pug/views/contact.pug
Normal file
21
Движок Pug/views/contact.pug
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>#{title}</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
h1 #{title} в Pug
|
||||
|
||||
if emailsVisible
|
||||
h3 Электронные адреса
|
||||
ul
|
||||
each email in emails
|
||||
li=email
|
||||
else
|
||||
h3 Электроннный адрес отсутствует
|
||||
p Телефон: #{phone}
|
||||
</body>
|
||||
<html>
|
||||
|
||||
Reference in New Issue
Block a user