Set indent size

This commit is contained in:
Damien Broqua 2022-02-13 18:07:53 +01:00
parent 33c87b434c
commit 3ebdc9c06a
9 changed files with 143 additions and 155 deletions

View file

@ -46,6 +46,7 @@
"connect-flash": "^0.1.1", "connect-flash": "^0.1.1",
"connect-mongo": "^4.6.0", "connect-mongo": "^4.6.0",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"debug": "^4.3.3",
"ejs": "^3.1.6", "ejs": "^3.1.6",
"express": "^4.17.2", "express": "^4.17.2",
"express-session": "^1.17.2", "express-session": "^1.17.2",

View file

@ -50,10 +50,8 @@ if (["production"].indexOf(env) !== -1) {
/* eslint-disable func-names */ /* eslint-disable func-names */
app.use((req, res, next) => { app.use((req, res, next) => {
if (req.secure) { if (req.secure) {
// request was via https, so do no special handling
next(); next();
} else { } else {
// request was via http, so redirect to https
res.redirect(`https://${req.headers.host}${req.url}`); res.redirect(`https://${req.headers.host}${req.url}`);
} }
}); });

View file

@ -4,39 +4,32 @@
* Module dependencies. * Module dependencies.
*/ */
import app from '../app'; import debugLib from "debug";
import debugLib from 'debug'; import http from "http";
import http from 'http'; import app from "../app";
import {port} from '../config'; import { port } from "../config";
const debug = debugLib('nodecdtheque:server'); const debug = debugLib("nodecdtheque:server");
const server = http.createServer(app); const server = http.createServer(app);
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/** /**
* Event listener for HTTP server "error" event. * Event listener for HTTP server "error" event.
* @param {*} error * @param {*} error
*/ */
function onError(error) { function onError(error) {
if (error.syscall !== 'listen') { if (error.syscall !== "listen") {
throw error; throw error;
} }
const bind = typeof port === 'string' ? const bind = typeof port === "string" ? `Pipe ${port}` : `Port ${port}`;
'Pipe ' + port :
'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) { switch (error.code) {
case 'EACCES': case "EACCES":
console.error(bind + ' requires elevated privileges'); console.error(`${bind} requires elevated privileges`);
process.exit(1); process.exit(1);
break; break;
case 'EADDRINUSE': case "EADDRINUSE":
console.error(bind + ' is already in use'); console.error(`${bind} is already in use`);
process.exit(1); process.exit(1);
break; break;
default: default:
@ -49,9 +42,11 @@ function onError(error) {
*/ */
function onListening() { function onListening() {
const addr = server.address(); const addr = server.address();
const bind = typeof addr === 'string' ? const bind =
'pipe ' + addr : typeof addr === "string" ? `pipe ${addr}` : `port ${addr.port}`;
'port ' + addr.port; debug(`Listening on ${bind}`);
debug('Listening on ' + bind);
} }
server.listen(port);
server.on("error", onError);
server.on("listening", onListening);

View file

@ -1,8 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<%- include('partials/head', {page: page, user: user}); %> <%- include('partials/head', {page: page, user: user}); %>
<body class="error"> <body class="error">
<%- include('partials/header'); %> <%- include('partials/header'); %>
<main class="mt-4"> <main class="mt-4">
<div class="container"> <div class="container">
@ -18,6 +18,5 @@
</div> </div>
</main> </main>
<%- include('partials/footer', {page: page, user: user, blog: null}); %> <%- include('partials/footer', {page: page, user: user, blog: null}); %>
</body> </body>
</html> </html>

View file

@ -9,6 +9,7 @@
<%= page.failureFlash %> <%= page.failureFlash %>
</div> </div>
<% } %> <% } %>
<% <%
if (error && error.length > 0) { if (error && error.length > 0) {
for( let i = 0 ; i < error.length ; i += 1 ) { for( let i = 0 ; i < error.length ; i += 1 ) {

View file

@ -17,9 +17,7 @@
<button class="btn btn-primary btn-block my-4" type="submit">Connexion</button> <button class="btn btn-primary btn-block my-4" type="submit">Connexion</button>
<p>Pas encore inscrit ? <p>Pas encore inscrit ? <a href="/inscription">Inscrivez-vous</a></p>
<a href="/inscription">Inscrivez-vous</a>
</p>
</form> </form>
</div> </div>
</div> </div>

View file

@ -22,9 +22,7 @@
<button class="btn btn-primary btn-block my-4" type="submit">Inscription</button> <button class="btn btn-primary btn-block my-4" type="submit">Inscription</button>
<p>Déjà inscrit ? <p>Déjà inscrit ? <a href="/connexion">Connectez-vous</a></p>
<a href="/connexion">Connectez-vous</a>
</p>
</form> </form>
</div> </div>
</div> </div>

View file

@ -1,5 +1,4 @@
<head> <head>
<!-- Required meta tags -->
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">

View file

@ -11,8 +11,7 @@
<a class="nav-link" href="/upload">Ajouter une image</a> <a class="nav-link" href="/upload">Ajouter une image</a>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Mon compte</a>
aria-expanded="false">Mon compte</a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="/gallery">Mes images</a> <a class="dropdown-item" href="/gallery">Mes images</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>