You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
600 B
29 lines
600 B
import { publicDir } from "@/util";
|
|
const Inert = require("@hapi/inert");
|
|
|
|
const filePlugin = {
|
|
name: "filePlugin",
|
|
version: "0.0.1",
|
|
register: async function (server, options) {
|
|
server.settings.routes = {
|
|
files: {
|
|
relativeTo: publicDir,
|
|
},
|
|
};
|
|
await server.register(Inert);
|
|
server.route({
|
|
method: "GET",
|
|
path: "/public/{param*}",
|
|
config: { auth: false },
|
|
handler: {
|
|
directory: {
|
|
path: publicDir,
|
|
index: true,
|
|
redirectToSlash: true,
|
|
},
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default filePlugin;
|
|
|