Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let options = {};
if (Array.isArray(x)) {
options = x[1];
x = x[0];
}
// absolute: use as path
// else: assume dir under srcDir
// TBD: handle it being a module
return {
subapp: subAppsByPath[Path.isAbsolute(x) ? x : Path.resolve(srcDir, x)],
options
};
});
}
const routeHandler = ReactWebapp.makeRouteHandler(routeOptions);
const handler = async (request, h) => {
try {
const context = await routeHandler({
content: { html: "", status: 200, useStream: true },
mode: "",
request
});
const data = context.result;
const status = data.status;
if (status === undefined) {
return h
.response(data)
.type("text/html; charset=UTF-8")
.code(200);
const { route } = r;
const routeOptions = Object.assign(
{},
topOpts,
_.pick(route, ["pageTitle", "bundleChunkSelector", "templateFile"])
);
assert(routeOptions.templateFile, `subapp-server: route ${r.name} must define templateFile`);
updateFullTemplate(r.dir, routeOptions);
const chunkSelector = resolveChunkSelector(routeOptions);
routeOptions.__internals = { chunkSelector };
const routeHandler = ReactWebapp.makeRouteHandler(routeOptions);
const handler = async (request, h) => {
try {
const context = await routeHandler({
content: { html: "", status: 200, useStream: true },
mode: "",
request
});
const data = context.result;
const status = data.status;
if (status === undefined) {
return h
.response(data)
.type("text/html; charset=UTF-8")
.code(200);