Answer the question
In order to leave comments, you need to log in
How to display pages in express?
I have such a problem, I seem to have done everything right, but for some reason I can’t display the page, it says that 404 error
All the path is something like
routes/
registration.js
views/
registration.pug
app.js
In the file routes/registration.js
let express = require('express');
let router = express.Router();
router.get('/registration', (req, res, next) => {
res.render('registration', {title: 'Региcтрация'})
});
module.exports = router;
extends layout
block content
.container
h1=title
label(for='login') Имя пользователя
input#login(type='text', name='login')
label(for='password') Пароль
input#password(type='text', name='password')
button(class='btn waves-effect waves-light') Зарегистрировать пользователя
let registration = require('./routes/registration'),
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.use('/registration', registration);
extends layout
block content
//p Welcome to #{title}
.container
h1= title
form(method='post')
.loginForm
label(for='login') Логин
br
input#login(type='text', name='login')
.passwordForm
label(for='password') Пароль
br
input#password(type='password', name='password')
button(class='btn waves-effect waves-light', type='Login') Войти
a(href='/registration') Зарегестрироваться
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question