Ghost/core/server/web/admin/controller.js
kirrg001 434a0435fd Optimised web/ debug logs
no issue

- optimised only for web/ folder, because it has used very general namespaces
- the debug namespace must be specific, otherwise i run `DEBUG=ghost:api:*` and i get web debug logs and api folder debug logs
- we can come up with a new namespace system, but for now it must be explicit enough
2018-10-04 17:43:08 +02:00

24 lines
748 B
JavaScript

const debug = require('ghost-ignition').debug('web:admin:controller');
const path = require('path');
const config = require('../../config');
const updateCheck = require('../../update-check');
const common = require('../../lib/common');
// Route: index
// Path: /ghost/
// Method: GET
module.exports = function adminController(req, res) {
debug('index called');
// run in background, don't block the admin rendering
updateCheck()
.catch((err) => {
common.logging.error(err);
});
const defaultTemplate = config.get('env') === 'production' ? 'default-prod.html' : 'default.html';
const templatePath = path.resolve(config.get('paths').adminViews, defaultTemplate);
res.sendFile(templatePath);
};