Set indent size
This commit is contained in:
parent
33c87b434c
commit
3ebdc9c06a
9 changed files with 143 additions and 155 deletions
|
@ -46,6 +46,7 @@
|
|||
"connect-flash": "^0.1.1",
|
||||
"connect-mongo": "^4.6.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"debug": "^4.3.3",
|
||||
"ejs": "^3.1.6",
|
||||
"express": "^4.17.2",
|
||||
"express-session": "^1.17.2",
|
||||
|
|
|
@ -50,10 +50,8 @@ if (["production"].indexOf(env) !== -1) {
|
|||
/* eslint-disable func-names */
|
||||
app.use((req, res, next) => {
|
||||
if (req.secure) {
|
||||
// request was via https, so do no special handling
|
||||
next();
|
||||
} else {
|
||||
// request was via http, so redirect to https
|
||||
res.redirect(`https://${req.headers.host}${req.url}`);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,39 +4,32 @@
|
|||
* Module dependencies.
|
||||
*/
|
||||
|
||||
import app from '../app';
|
||||
import debugLib from 'debug';
|
||||
import http from 'http';
|
||||
import {port} from '../config';
|
||||
import debugLib from "debug";
|
||||
import http from "http";
|
||||
import app from "../app";
|
||||
import { port } from "../config";
|
||||
|
||||
const debug = debugLib('nodecdtheque:server');
|
||||
const debug = debugLib("nodecdtheque:server");
|
||||
const server = http.createServer(app);
|
||||
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
* @param {*} error
|
||||
*/
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
if (error.syscall !== "listen") {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const bind = typeof port === 'string' ?
|
||||
'Pipe ' + port :
|
||||
'Port ' + port;
|
||||
const bind = typeof port === "string" ? `Pipe ${port}` : `Port ${port}`;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
case "EACCES":
|
||||
console.error(`${bind} requires elevated privileges`);
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
case "EADDRINUSE":
|
||||
console.error(`${bind} is already in use`);
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
|
@ -49,9 +42,11 @@ function onError(error) {
|
|||
*/
|
||||
function onListening() {
|
||||
const addr = server.address();
|
||||
const bind = typeof addr === 'string' ?
|
||||
'pipe ' + addr :
|
||||
'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
const bind =
|
||||
typeof addr === "string" ? `pipe ${addr}` : `port ${addr.port}`;
|
||||
debug(`Listening on ${bind}`);
|
||||
}
|
||||
|
||||
server.listen(port);
|
||||
server.on("error", onError);
|
||||
server.on("listening", onListening);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<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'); %>
|
||||
<main class="mt-4">
|
||||
<div class="container">
|
||||
|
@ -18,6 +18,5 @@
|
|||
</div>
|
||||
</main>
|
||||
<%- include('partials/footer', {page: page, user: user, blog: null}); %>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -9,6 +9,7 @@
|
|||
<%= page.failureFlash %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<%
|
||||
if (error && error.length > 0) {
|
||||
for( let i = 0 ; i < error.length ; i += 1 ) {
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
|
||||
<button class="btn btn-primary btn-block my-4" type="submit">Connexion</button>
|
||||
|
||||
<p>Pas encore inscrit ?
|
||||
<a href="/inscription">Inscrivez-vous</a>
|
||||
</p>
|
||||
<p>Pas encore inscrit ? <a href="/inscription">Inscrivez-vous</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
<button class="btn btn-primary btn-block my-4" type="submit">Inscription</button>
|
||||
|
||||
<p>Déjà inscrit ?
|
||||
<a href="/connexion">Connectez-vous</a>
|
||||
</p>
|
||||
<p>Déjà inscrit ? <a href="/connexion">Connectez-vous</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
<a class="nav-link" href="/upload">Ajouter une image</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
|
||||
aria-expanded="false">Mon compte</a>
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Mon compte</a>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="/gallery">Mes images</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
Loading…
Reference in a new issue