How to use the @plumier/core.invoke function in @plumier/core

To help you get started, we’ve selected a few @plumier/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plumier / plumier / packages / serve-static / src / index.ts View on Github external
async execute(i: Readonly): Promise {
        const isFile = !!mime.lookup(i.ctx.path)
        const route = i.ctx.routes.find(x => x.action.decorators.some(x => x.type === "HistoryApiFallback"))
        //no context.route = no controller = no handler
        if (!i.ctx.route && i.ctx.state.caller === "system" && !isFile && !!route && i.ctx.request.method === "GET" && i.ctx.request.accepts("html")) {
            return invoke(i.ctx, route)
        }
        else
            return i.proceed()
    }
}