26 lines
524 B
JavaScript
Raw Normal View History

2016-08-26 14:19:03 +02:00
'use strict';
const fs = require('fs');
2016-08-26 14:19:03 +02:00
const path = require('path');
2016-08-26 14:19:03 +02:00
/**
* A set of functions called "actions" for `Admin`
*/
module.exports = {
2016-12-01 16:44:03 +01:00
index: async ctx => {
2016-11-22 12:05:02 +01:00
// Send the HTML file with injected scripts
ctx.body = strapi.admin.services.admin.generateAdminIndexFile();
2016-08-26 14:19:03 +02:00
},
2016-12-01 16:44:03 +01:00
file: async ctx => {
try {
const file = fs.readFileSync(path.resolve(__dirname, '..', 'public', 'build', ctx.params.file));
ctx.body = file;
} catch (err) {
ctx.body = ctx.notFound();
}
2016-08-26 14:19:03 +02:00
}
};