mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 22:31:15 +00:00
Configure Express and add public files
This commit is contained in:
17
app.js
17
app.js
@@ -18,6 +18,13 @@ function initApp (config, callback) {
|
|||||||
app.server = http.createServer(app.express);
|
app.server = http.createServer(app.express);
|
||||||
app.webservice = createClient(config.webservice);
|
app.webservice = createClient(config.webservice);
|
||||||
|
|
||||||
|
// Express config
|
||||||
|
app.express.disable('x-powered-by');
|
||||||
|
app.express.use(express.static(__dirname + '/public', {
|
||||||
|
maxAge: (process.env.NODE_ENV === 'production' ? 604800 : 0)
|
||||||
|
}));
|
||||||
|
app.express.use(express.compress());
|
||||||
|
|
||||||
// View engine
|
// View engine
|
||||||
app.express.set('views', __dirname + '/view');
|
app.express.set('views', __dirname + '/view');
|
||||||
app.express.engine('html', hbs.express3({
|
app.express.engine('html', hbs.express3({
|
||||||
@@ -29,6 +36,16 @@ function initApp (config, callback) {
|
|||||||
}));
|
}));
|
||||||
app.express.set('view engine', 'html');
|
app.express.set('view engine', 'html');
|
||||||
|
|
||||||
|
// Populate view locals
|
||||||
|
app.express.locals({
|
||||||
|
lang: 'en',
|
||||||
|
year: (new Date()).getFullYear()
|
||||||
|
});
|
||||||
|
app.express.use(function (req, res, next) {
|
||||||
|
res.locals.host = req.host;
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
// Load routes
|
// Load routes
|
||||||
require('./route/index')(app);
|
require('./route/index')(app);
|
||||||
require('./route/new')(app);
|
require('./route/new')(app);
|
||||||
|
6
public/example.css
Normal file
6
public/example.css
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
/* Just an example CSS file. Delete it when you add actual CSS */
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
@@ -1,11 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{lang}}">
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>{{block "title"}}</title>
|
<title>{{block "title"}}</title>
|
||||||
<meta name="description" content="{{block "description"}}"/>
|
<meta name="description" content="{{block "description"}}"/>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/example.css"/>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user