-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (28 loc) · 1.21 KB
/
index.js
File metadata and controls
34 lines (28 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const express = require('express');
const app = express();
const path = require('path');
const ejs = require('ejs');
// Создание методов для вывода статических файлов, таких как css, js, images, fonts, etc.
app.use(express.static(path.join(__dirname, 'public')));
app.use('/css', express.static(path.join(__dirname, 'node_modules/bootstrap/dist/css')))
app.use('/js', express.static(path.join(__dirname, 'node_modules/bootstrap/dist/js')))
app.use('/js', express.static(path.join(__dirname, 'node_modules/jquery/dist')))
app.use('/js', express.static(path.join(__dirname, 'node_modules/inputmask/dist')))
// Создание маршрута для index страницы
app.get('/', (req, res) => {
res.sendFile(`${__dirname}./public/index.html`);
});
// Создание маршрута для authorization страницы
app.get('/authorization', (req, res) => {
res.sendFile(path.join(__dirname, './public/authorization.html'));
});
app.listen(34567, () => {
console.log('Application listening on port 3333!');
});
ejs.renderFile('views/pagehome.ejs', (err, data) => {
if (err) {
console.error(err);
} else {
console.log(data);
}
});