feat: use static files to share css between templates
This commit is contained in:
parent
72d04bdab1
commit
dc68a07a1b
@ -1,9 +1,11 @@
|
||||
import express from 'express';
|
||||
import path from 'path';
|
||||
import db from '../db';
|
||||
import { getUsername, verifyAuthentication } from '../middlewares/auth.middleware'
|
||||
import authRoute from './auth.route'
|
||||
import marquesRoute from './marque.route'
|
||||
import memberRouter from './member.route'
|
||||
import modelRouter from './model.route';
|
||||
|
||||
const routes = express.Router();
|
||||
|
||||
@ -17,8 +19,11 @@ routes.get("/message", async (_req, res) => {
|
||||
res.render('index.ejs', { message });
|
||||
});
|
||||
|
||||
routes.use("/static", express.static(path.join(__dirname, '../static')));
|
||||
|
||||
routes.use("/auth", authRoute);
|
||||
routes.use("/marques", getUsername, verifyAuthentication, marquesRoute);
|
||||
routes.use("/membres", memberRouter);
|
||||
routes.use("/models", modelRouter);
|
||||
|
||||
export default routes;
|
||||
|
7
back-end/src/static/css/colors.css
Normal file
7
back-end/src/static/css/colors.css
Normal file
@ -0,0 +1,7 @@
|
||||
:root {
|
||||
--fg: #161925;
|
||||
--bg: #FDFFFC;
|
||||
--blue: #235789;
|
||||
--red: #C1292E;
|
||||
--yellow: #F1D302;
|
||||
}
|
22
back-end/src/static/css/header.css
Normal file
22
back-end/src/static/css/header.css
Normal file
@ -0,0 +1,22 @@
|
||||
.header nav ul {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: var(--fg);
|
||||
color: var(--bg);
|
||||
}
|
||||
|
||||
.header a {
|
||||
color: var(--bg);
|
||||
}
|
||||
|
||||
.header li {
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
.header li:hover {
|
||||
background-color: var(--bg);
|
||||
color: var(--fg);
|
||||
}
|
11
back-end/src/static/css/reset.css
Normal file
11
back-end/src/static/css/reset.css
Normal file
@ -0,0 +1,11 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
outline: 0;
|
||||
border: 0;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
pre, code {
|
||||
font-family: monospace;
|
||||
}
|
@ -5,6 +5,8 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Leohl !dworl</title>
|
||||
|
||||
<%- include('partials/links.ejs') %>
|
||||
</head>
|
||||
<body>
|
||||
<%- include('partials/header.ejs') %>
|
||||
|
@ -7,6 +7,8 @@
|
||||
<title>
|
||||
<%= member.name %>
|
||||
</title>
|
||||
|
||||
<%- include('partials/links.ejs') %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<title>
|
||||
Liste des membres
|
||||
</title>
|
||||
|
||||
<%- include('partials/links.ejs') %>
|
||||
</head>
|
||||
<body>
|
||||
<%- include('partials/header.ejs') %>
|
||||
|
0
back-end/src/templates/notfound.ejs
Normal file
0
back-end/src/templates/notfound.ejs
Normal file
@ -1,18 +1,17 @@
|
||||
<style>
|
||||
.header nav ul {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
}
|
||||
</style>
|
||||
<header class="header">
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/membres">
|
||||
Membres
|
||||
</a>
|
||||
</li>
|
||||
<a href="/membres">
|
||||
<li>
|
||||
Membres
|
||||
</li>
|
||||
</a>
|
||||
|
||||
<a href="/models">
|
||||
<li>
|
||||
Modèles
|
||||
</li>
|
||||
</a>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
3
back-end/src/templates/partials/links.ejs
Normal file
3
back-end/src/templates/partials/links.ejs
Normal file
@ -0,0 +1,3 @@
|
||||
<link href="/static/css/colors.css" rel="stylesheet" />
|
||||
<link href="/static/css/header.css" rel="stylesheet" />
|
||||
<link href="/static/css/reset.css" rel="stylesheet" />
|
Loading…
x
Reference in New Issue
Block a user