From 40d6f1357fd2bf22af7faadc3e6a67525237f578 Mon Sep 17 00:00:00 2001 From: Esther Date: Thu, 18 Jun 2020 22:56:03 +0100 Subject: [PATCH] Changed indent spaces and made localhost only --- app.js | 22 +++++------ bin/www | 74 +++++++++++++++++------------------ public/stylesheets/style.sass | 6 +-- routes/index.js | 2 +- routes/users.js | 2 +- views/error.pug | 6 +-- views/index.pug | 4 +- views/layout.pug | 10 ++--- 8 files changed, 63 insertions(+), 63 deletions(-) diff --git a/app.js b/app.js index 0dc361f..f0b0b76 100644 --- a/app.js +++ b/app.js @@ -19,10 +19,10 @@ app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use(cookieParser()); app.use(sassMiddleware({ - src: path.join(__dirname, 'public'), - dest: path.join(__dirname, 'public'), - indentedSyntax: true, // true = .sass and false = .scss - sourceMap: true + src: path.join(__dirname, 'public'), + dest: path.join(__dirname, 'public'), + indentedSyntax: true, // true = .sass and false = .scss + sourceMap: true })); app.use(express.static(path.join(__dirname, 'public'))); @@ -31,18 +31,18 @@ app.use('/users', usersRouter); // catch 404 and forward to error handler app.use(function(req, res, next) { - next(createError(404)); + next(createError(404)); }); // error handler app.use(function(err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message; - res.locals.error = req.app.get('env') === 'development' ? err : {}; + // set locals, only providing error in development + res.locals.message = err.message; + res.locals.error = req.app.get('env') === 'development' ? err : {}; - // render the error page - res.status(err.status || 500); - res.render('error'); + // render the error page + res.status(err.status || 500); + res.render('error'); }); module.exports = app; diff --git a/bin/www b/bin/www index f1ba66a..3c4ec55 100755 --- a/bin/www +++ b/bin/www @@ -12,7 +12,7 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '3000'); +var port = normalizePort(process.env.PORT || '7000'); app.set('port', port); /** @@ -22,10 +22,10 @@ app.set('port', port); var server = http.createServer(app); /** - * Listen on provided port, on all network interfaces. + * Listen on provided port, on all localhost. */ -server.listen(port); +server.listen(port, 'localhost'); server.on('error', onError); server.on('listening', onListening); @@ -34,19 +34,19 @@ server.on('listening', onListening); */ function normalizePort(val) { - var port = parseInt(val, 10); + var port = parseInt(val, 10); - if (isNaN(port)) { - // named pipe - return val; - } + if (isNaN(port)) { + // named pipe + return val; + } - if (port >= 0) { - // port number - return port; - } + if (port >= 0) { + // port number + return port; + } - return false; + return false; } /** @@ -54,27 +54,27 @@ function normalizePort(val) { */ function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } + if (error.syscall !== 'listen') { + throw error; + } - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; + var 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'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } + // handle specific listen errors with friendly messages + switch (error.code) { + case 'EACCES': + console.error(bind + ' requires elevated privileges'); + process.exit(1); + break; + case 'EADDRINUSE': + console.error(bind + ' is already in use'); + process.exit(1); + break; + default: + throw error; + } } /** @@ -82,9 +82,9 @@ function onError(error) { */ function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); + var addr = server.address(); + var bind = typeof addr === 'string' + ? 'pipe ' + addr + : 'port ' + addr.port; + debug('Listening on ' + bind); } diff --git a/public/stylesheets/style.sass b/public/stylesheets/style.sass index d683e30..6d1ef15 100644 --- a/public/stylesheets/style.sass +++ b/public/stylesheets/style.sass @@ -1,6 +1,6 @@ body - padding: 50px - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif + padding: 50px + font: 14px "Lucida Grande", Helvetica, Arial, sans-serif a - color: #00B7FF + color: #00B7FF diff --git a/routes/index.js b/routes/index.js index ecca96a..a0036fe 100644 --- a/routes/index.js +++ b/routes/index.js @@ -3,7 +3,7 @@ var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { - res.render('index', { title: 'Express' }); + res.render('index', { title: 'Express' }); }); module.exports = router; diff --git a/routes/users.js b/routes/users.js index 623e430..550ff28 100644 --- a/routes/users.js +++ b/routes/users.js @@ -3,7 +3,7 @@ var router = express.Router(); /* GET users listing. */ router.get('/', function(req, res, next) { - res.send('respond with a resource'); + res.send('respond with a resource'); }); module.exports = router; diff --git a/views/error.pug b/views/error.pug index 51ec12c..3b25cfa 100644 --- a/views/error.pug +++ b/views/error.pug @@ -1,6 +1,6 @@ extends layout block content - h1= message - h2= error.status - pre #{error.stack} + h1= message + h2= error.status + pre #{error.stack} diff --git a/views/index.pug b/views/index.pug index 3d63b9a..bb9f32f 100644 --- a/views/index.pug +++ b/views/index.pug @@ -1,5 +1,5 @@ extends layout block content - h1= title - p Welcome to #{title} + h1 Yoooooooooooooooooo + p Yoooooooooooooooooooooooooooooooo diff --git a/views/layout.pug b/views/layout.pug index 15af079..6dc17d8 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -1,7 +1,7 @@ doctype html html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.css') - body - block content + head + title= title + link(rel='stylesheet', href='/stylesheets/style.css') + body + block content