How to use the @plumier/core.response.file 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 / swagger / src / index.ts View on Github external
async execute(invocation: Readonly): Promise {
        const uiPath = this.opt.endpoint.toLowerCase() + "/index"
        if (invocation.context.path.toLowerCase() === "/swagger.json")
            return response.json(this.spec)
        if (invocation.context.path.toLowerCase() === this.opt.endpoint.toLowerCase())
            return response.redirect(uiPath)
        if (invocation.context.path.toLowerCase() === uiPath)
            return response.file(join(dist.getAbsoluteFSPath(), "index.html"))
        else
            return invocation.proceed()
    }
}