mirror of
https://github.com/strapi/strapi.git
synced 2025-07-19 15:06:11 +00:00
34 lines
651 B
JavaScript
34 lines
651 B
JavaScript
'use strict';
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
/**
|
|
* A set of functions called "actions" for `Admin`
|
|
*/
|
|
|
|
module.exports = {
|
|
|
|
index: async (ctx) => {
|
|
try {
|
|
// Send the HTML file with injected scripts
|
|
ctx.body = strapi.admin.services.admin.generateAdminIndexFile();
|
|
} catch (err) {
|
|
ctx.body = err;
|
|
}
|
|
},
|
|
|
|
models: async (ctx) => {
|
|
ctx.body = strapi.models;
|
|
},
|
|
|
|
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();
|
|
}
|
|
}
|
|
};
|