\\ app.js
const express = require("express");
const app = express();
const path = require("path")
const port = 8080
app.set("view engine", "pug");
app.set("views");
app.use("/", function(request, response){
response.render("index");
});
app.use(express.static(path.join(__dirname, 'static')));
app.listen(port, () => console.log(`http://localhost:${8080}`));
\\views\pug.js
doctype html
html
head
meta(charset="utf-8")
title Заголовок страницы
link(type="Image/x-icon" href="/favicon.png" rel="icon")
style
include ./static/styles/style.css //\\Хотелось бы через link(href="..."), но ошибка Content-Type - text/html
body
script
include ./static/scripts/script.js \\Хотелось бы через script(src="..."), но ошибка Content-Type - text/html
\\ app.js
const express = require("express");
const app = express();
const path = require("path")
const port = 8080
app.set("view engine", "pug");
app.set("views");
app.get("/", function(request, response){
response.render("index");
});
app.use(express.static(path.join(__dirname, 'static')));
app.use(express.static(path.join(__dirname, 'views')));
app.listen(port, () => console.log(`http://localhost:${8080}`));
doctype html
html
head
meta(charset="utf-8")
title Заголовок страницы
link(type="Image/x-icon" href="/favicon.png" rel="icon")
link(type='text/css' href='./static/styles/style.css' rel='stylesheet')
body
script(type='text/javascript' src='./static/scripts/script.js')