mirror of
https://github.com/aurora-dot/pastel.codes.git
synced 2024-11-22 08:12:19 +00:00
Changed indent spaces and made localhost only
This commit is contained in:
parent
91eb61fc81
commit
40d6f1357f
22
app.js
22
app.js
@ -19,10 +19,10 @@ app.use(express.json());
|
|||||||
app.use(express.urlencoded({ extended: false }));
|
app.use(express.urlencoded({ extended: false }));
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
app.use(sassMiddleware({
|
app.use(sassMiddleware({
|
||||||
src: path.join(__dirname, 'public'),
|
src: path.join(__dirname, 'public'),
|
||||||
dest: path.join(__dirname, 'public'),
|
dest: path.join(__dirname, 'public'),
|
||||||
indentedSyntax: true, // true = .sass and false = .scss
|
indentedSyntax: true, // true = .sass and false = .scss
|
||||||
sourceMap: true
|
sourceMap: true
|
||||||
}));
|
}));
|
||||||
app.use(express.static(path.join(__dirname, 'public')));
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
@ -31,18 +31,18 @@ app.use('/users', usersRouter);
|
|||||||
|
|
||||||
// catch 404 and forward to error handler
|
// catch 404 and forward to error handler
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
next(createError(404));
|
next(createError(404));
|
||||||
});
|
});
|
||||||
|
|
||||||
// error handler
|
// error handler
|
||||||
app.use(function(err, req, res, next) {
|
app.use(function(err, req, res, next) {
|
||||||
// set locals, only providing error in development
|
// set locals, only providing error in development
|
||||||
res.locals.message = err.message;
|
res.locals.message = err.message;
|
||||||
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||||
|
|
||||||
// render the error page
|
// render the error page
|
||||||
res.status(err.status || 500);
|
res.status(err.status || 500);
|
||||||
res.render('error');
|
res.render('error');
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
74
bin/www
74
bin/www
@ -12,7 +12,7 @@ var http = require('http');
|
|||||||
* Get port from environment and store in Express.
|
* 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);
|
app.set('port', port);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,10 +22,10 @@ app.set('port', port);
|
|||||||
var server = http.createServer(app);
|
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('error', onError);
|
||||||
server.on('listening', onListening);
|
server.on('listening', onListening);
|
||||||
|
|
||||||
@ -34,19 +34,19 @@ server.on('listening', onListening);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function normalizePort(val) {
|
function normalizePort(val) {
|
||||||
var port = parseInt(val, 10);
|
var port = parseInt(val, 10);
|
||||||
|
|
||||||
if (isNaN(port)) {
|
if (isNaN(port)) {
|
||||||
// named pipe
|
// named pipe
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port >= 0) {
|
if (port >= 0) {
|
||||||
// port number
|
// port number
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,27 +54,27 @@ function normalizePort(val) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onError(error) {
|
function onError(error) {
|
||||||
if (error.syscall !== 'listen') {
|
if (error.syscall !== 'listen') {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bind = typeof port === 'string'
|
var bind = typeof port === 'string'
|
||||||
? 'Pipe ' + port
|
? 'Pipe ' + port
|
||||||
: 'Port ' + port;
|
: 'Port ' + port;
|
||||||
|
|
||||||
// handle specific listen errors with friendly messages
|
// 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:
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,9 +82,9 @@ function onError(error) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onListening() {
|
function onListening() {
|
||||||
var addr = server.address();
|
var addr = server.address();
|
||||||
var bind = typeof addr === 'string'
|
var bind = typeof addr === 'string'
|
||||||
? 'pipe ' + addr
|
? 'pipe ' + addr
|
||||||
: 'port ' + addr.port;
|
: 'port ' + addr.port;
|
||||||
debug('Listening on ' + bind);
|
debug('Listening on ' + bind);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
body
|
body
|
||||||
padding: 50px
|
padding: 50px
|
||||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif
|
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif
|
||||||
|
|
||||||
a
|
a
|
||||||
color: #00B7FF
|
color: #00B7FF
|
||||||
|
@ -3,7 +3,7 @@ var router = express.Router();
|
|||||||
|
|
||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/', function(req, res, next) {
|
router.get('/', function(req, res, next) {
|
||||||
res.render('index', { title: 'Express' });
|
res.render('index', { title: 'Express' });
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -3,7 +3,7 @@ var router = express.Router();
|
|||||||
|
|
||||||
/* GET users listing. */
|
/* GET users listing. */
|
||||||
router.get('/', function(req, res, next) {
|
router.get('/', function(req, res, next) {
|
||||||
res.send('respond with a resource');
|
res.send('respond with a resource');
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
extends layout
|
extends layout
|
||||||
|
|
||||||
block content
|
block content
|
||||||
h1= message
|
h1= message
|
||||||
h2= error.status
|
h2= error.status
|
||||||
pre #{error.stack}
|
pre #{error.stack}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
extends layout
|
extends layout
|
||||||
|
|
||||||
block content
|
block content
|
||||||
h1= title
|
h1 Yoooooooooooooooooo
|
||||||
p Welcome to #{title}
|
p Yoooooooooooooooooooooooooooooooo
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
doctype html
|
doctype html
|
||||||
html
|
html
|
||||||
head
|
head
|
||||||
title= title
|
title= title
|
||||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||||
body
|
body
|
||||||
block content
|
block content
|
||||||
|
Loading…
Reference in New Issue
Block a user