From e4585f88838f51e31e6452a650bbcd4b2d8f482f Mon Sep 17 00:00:00 2001 From: Sergey Yarkov Date: Wed, 13 Nov 2019 18:26:38 +0300 Subject: [PATCH] Added all routes --- config/routes/routes.js | 35 ++++++++++++++++++-- config/server.js | 16 ++++----- dist/public/css/style.css | 10 +++--- dist/views/assets/templates/header.pug | 22 ++++++------- dist/views/comments.pug | 27 ++++++++++++++++ dist/views/contacts.pug | 28 ++++++++++++++++ dist/views/how-to-buy.pug | 45 ++++++++++++++++++++++++++ dist/views/my-orders.pug | 33 +++++++++++++++++++ 8 files changed, 188 insertions(+), 28 deletions(-) create mode 100644 dist/views/comments.pug create mode 100644 dist/views/contacts.pug create mode 100644 dist/views/how-to-buy.pug create mode 100644 dist/views/my-orders.pug diff --git a/config/routes/routes.js b/config/routes/routes.js index 1437b0f..ba3273e 100644 --- a/config/routes/routes.js +++ b/config/routes/routes.js @@ -1,5 +1,34 @@ -module.exports = function(app) { - app.get('/', (req, res) => { +const routes = { + // Index + indexRoute: function(req, res) { res.render('index'); - }); + }, + + // How-to-buy + howToBuyRoute: function(req, res) { + res.render('how-to-buy'); + }, + + // Contacts + contactsRoute: function(req, res) { + res.render('contacts'); + }, + + // Comments + commentsRoute: function(req, res) { + res.render('comments'); + }, + + // My-orders + myOrdersRoute: function(req, res) { + res.render('my-orders'); + } +} + +module.exports = function(server) { + server.get('/', routes.indexRoute); + server.get('/how-to-buy', routes.howToBuyRoute); + server.get('/contacts', routes.contactsRoute); + server.get('/comments', routes.commentsRoute); + server.get('/my-orders', routes.myOrdersRoute) } \ No newline at end of file diff --git a/config/server.js b/config/server.js index b9eb66e..3c46e97 100644 --- a/config/server.js +++ b/config/server.js @@ -1,17 +1,15 @@ const express = require('express'); -const app = express(); +const server = express(); const path = require('path'); // Pug config -app.use(express.static(path.join(__dirname, '../dist/public'))); -app.set('view engine', 'pug'); -app.set('views', path.join(__dirname, '../dist/views')); - - -require('./routes/routes')(app); +server.use(express.static(path.join(__dirname, '../dist/public'))); +server.set('view engine', 'pug'); +server.set('views', path.join(__dirname, '../dist/views')); +require('./routes/routes')(server); // 404 Redirect -app.use((req, res) => res.status(404).send('Error 404')); +server.use((req, res) => res.status(404).send('Error 404')); -app.listen(3000, () => console.log('Listen port 3000...')); \ No newline at end of file +server.listen(3000, () => console.log('Listen port 3000...')); \ No newline at end of file diff --git a/dist/public/css/style.css b/dist/public/css/style.css index a9af030..e7d6ea5 100644 --- a/dist/public/css/style.css +++ b/dist/public/css/style.css @@ -19,13 +19,12 @@ h1 { color: #5d5d5d; } -html { +html, +body { font-family: "Roboto", sans-serif; font-weight: normal; -} - -body { background-color: #F3F3F3; + height: 100%; } a { @@ -317,6 +316,7 @@ nav { /* Main */ .main-section { margin-top: 6rem; + min-height: 100%; } header nav, @@ -625,7 +625,7 @@ footer .container { /* Footer */ footer { - margin-top: 5rem; + margin-top: 4rem; background-color: #25998f; padding-top: 10px; padding-bottom: 10px; diff --git a/dist/views/assets/templates/header.pug b/dist/views/assets/templates/header.pug index 506b24b..850468b 100644 --- a/dist/views/assets/templates/header.pug +++ b/dist/views/assets/templates/header.pug @@ -4,20 +4,20 @@ header a.sidenav-trigger(href='#' data-target='slide-out') i.material-icons menu .nav-wrapper.container - a.brand-logo.waves-effect.waves-light(href='#') + a.brand-logo.waves-effect.waves-light(href='/') i.material-icons shop_two span#header-title Digital Store ul.right.hide-on-med-and-down li.active - a(href='#') Главная + a(href='/') Главная li - a(href='#') Как купить товар + a(href='/how-to-buy') Как купить товар li - a(href='#') Контакты + a(href='/contacts') Контакты li - a(href='#') Отзывы + a(href='/comments') Отзывы li - a(href='#') Мои покупки + a(href='/my-orders') Мои покупки // Menu-Mobile Content ul#slide-out.sidenav li @@ -25,23 +25,23 @@ header li .divider li - a(href='#') + a(href='/') i.material-icons home | Главная li - a(href='#') + a(href='/how-to-buy') i.material-icons info | Как купить товар li - a(href='#') + a(href='/contacts') i.material-icons contact_support | Контакты li - a(href='#') + a(href='/comments') i.material-icons comment | Отзывы li - a(href='#') + a(href='/my-orders') i.material-icons shopping_cart | Мои покупки // Menu-Mobile Content END \ No newline at end of file diff --git a/dist/views/comments.pug b/dist/views/comments.pug new file mode 100644 index 0000000..825453d --- /dev/null +++ b/dist/views/comments.pug @@ -0,0 +1,27 @@ +//- Head HTML +include ./assets/head.pug +//- Header Template +include ./assets/templates/header.pug + +main.main-section + include ./assets/templates/modals/cart.pug + include ./assets/templates/modals/pay.pug + .container + .row + .col.s12 + #comments.comments.background + .comments-content + .comments-title.block-title + i.material-icons comment + h1 Отзывы о нашем магазине + .comments-text + hr + p + strong Отзывы + p   + p (тут блок с отзывами) + + + +//- Footer Template +include ./assets/templates/footer.pug \ No newline at end of file diff --git a/dist/views/contacts.pug b/dist/views/contacts.pug new file mode 100644 index 0000000..bc27b54 --- /dev/null +++ b/dist/views/contacts.pug @@ -0,0 +1,28 @@ +//- Head HTML +include ./assets/head.pug +//- Header Template +include ./assets/templates/header.pug + +main.main-section + include ./assets/templates/modals/cart.pug + include ./assets/templates/modals/pay.pug + .container + .row + .col.s12 + #contacts.contacts.background + .contacts-content + .contacts-title.block-title + i.material-icons contacts + h1 Связаться с нами + .contacts-text + hr + p + strong Контакты + p   + p 1. Почта: support@digital-store.ru + p 2. Telegram: + a(href='#') @digitalstore + + +//- Footer Template +include ./assets/templates/footer.pug \ No newline at end of file diff --git a/dist/views/how-to-buy.pug b/dist/views/how-to-buy.pug new file mode 100644 index 0000000..bff5da7 --- /dev/null +++ b/dist/views/how-to-buy.pug @@ -0,0 +1,45 @@ +//- Head HTML +include ./assets/head.pug +//- Header Template +include ./assets/templates/header.pug + +main.main-section + include ./assets/templates/modals/cart.pug + include ./assets/templates/modals/pay.pug + .container + .row + .col.s12 + #purchase.purchase.background + .purchase-content + .purchase-title.block-title + i.material-icons info + h1 Как купить товары в магазине? + .purchase-text + hr + p + strong Для того, чтобы купить аккаунты в магазине, нужно проделать следующие шаги: + p   + p + | Lorem, ipsum dolor sit amet consectetur adipisicing elit. Assumenda quisquam + | voluptate aut, rerum quidem facilis labore at porro, nulla accusantium voluptatum + | magnam deserunt dolores repudiandae earum beatae provident maiores eligendi + | explicabo asperiores adipisci aliquam quas. Quisquam inventore pariatur qui dolorum + | sunt eveniet, libero ut nobis? Temporibus, nihil qui quaerat pariatur non ullam + | cupiditate, repellendus similique saepe facere, harum soluta recusandae unde! Eius + | nobis alias ipsum rem sint sit optio eligendi, magnam suscipit incidunt. Delectus + | nulla labore debitis, aperiam provident iste veniam cupiditate perferendis odio + | nostrum, repellendus, possimus similique error. Vel error necessitatibus animi velit + | dolorem quod a cupiditate repudiandae obcaecati, dignissimos officiis blanditiis rem + | eaque amet aperiam veritatis perferendis impedit ab nam, voluptas magnam ullam ipsam + | voluptatem. Voluptas, eveniet quidem. Enim rem quis repudiandae ullam cum autem + | architecto similique, sint, recusandae, quae debitis modi quas eaque aspernatur + | officia quidem? Officiis at cumque quaerat! Qui totam doloremque eligendi nam culpa + | ullam, repudiandae iure adipisci facilis error autem recusandae dolorum? Consectetur + | minima, cupiditate non quod reprehenderit laudantium. Officiis soluta harum iusto + | sed nisi, provident deleniti illum quos in omnis nostrum, ipsam vero. Maxime + | architecto perspiciatis odit vel quae? Qui dolorem sit laborum eius voluptatum + | beatae facilis! Corrupti ex temporibus quia quam earum. + + +//- Footer Template +include ./assets/templates/footer.pug \ No newline at end of file diff --git a/dist/views/my-orders.pug b/dist/views/my-orders.pug new file mode 100644 index 0000000..490da45 --- /dev/null +++ b/dist/views/my-orders.pug @@ -0,0 +1,33 @@ +//- Head HTML +include ./assets/head.pug +//- Header Template +include ./assets/templates/header.pug + +main.main-section + include ./assets/templates/modals/cart.pug + include ./assets/templates/modals/pay.pug + .container + .row + .col.s12 + #orders.orders.background + .orders-content + .orders-title.block-title + i.material-icons shopping_cart + h1 Мои покупки + .orders-text + hr + p + strong Введите почту + p   + form(action='#') + .email-field(style='max-width: 400px;margin-bottom: 10px;') + label(for='email') Почта + input#email(required='' type='text' name='email') + .show-orders + button.waves-effect.waves-light.btn(type='submit') Узнать + + + + +//- Footer Template +include ./assets/templates/footer.pug \ No newline at end of file