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-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",
|
||||||
|
|
|
@ -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}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -19,5 +19,4 @@
|
||||||
</main>
|
</main>
|
||||||
<%- include('partials/footer', {page: page, user: user, blog: null}); %>
|
<%- include('partials/footer', {page: page, user: user, blog: null}); %>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -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 ) {
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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">
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue