final
This commit is contained in:
19
task33/app.js
Normal file
19
task33/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);
|
||||
1014
task33/package-lock.json
generated
Normal file
1014
task33/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
task33/package.json
Normal file
8
task33/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "expressapp",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"express": "^4.16.4",
|
||||
"pug": "^3.0.2"
|
||||
}
|
||||
}
|
||||
17
task33/views/contact.pug
Normal file
17
task33/views/contact.pug
Normal file
@@ -0,0 +1,17 @@
|
||||
extends layout.pug
|
||||
|
||||
block title
|
||||
<title>#{title}</title>
|
||||
|
||||
block content
|
||||
|
||||
<h1>#{title} в Pug</h1>
|
||||
if emailsVisible
|
||||
<h3>Электронные адреса</h3>
|
||||
<ul>
|
||||
each email in emails
|
||||
<li>#{email}</li>
|
||||
</ul>
|
||||
else
|
||||
<h3>Электронный адрес отсутствует</h3>
|
||||
<p>Телефон: #{phone}</p>
|
||||
1
task33/views/footer.pug
Normal file
1
task33/views/footer.pug
Normal file
@@ -0,0 +1 @@
|
||||
<footer><p>MyCorp - Copyright © 2017</p></footer>
|
||||
1
task33/views/header.pug
Normal file
1
task33/views/header.pug
Normal file
@@ -0,0 +1 @@
|
||||
<header><h1>Header</h1></header>
|
||||
12
task33/views/layout.pug
Normal file
12
task33/views/layout.pug
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
block title
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
include header.pug
|
||||
block content
|
||||
include footer.pug
|
||||
</body>
|
||||
<html>
|
||||
1
task33/views/partials/footer.hbs
Normal file
1
task33/views/partials/footer.hbs
Normal file
@@ -0,0 +1 @@
|
||||
<footer><p>MyCorp - Copyright © 2017</p></footer>
|
||||
4
task33/views/partials/menu.hbs
Normal file
4
task33/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