How to use the @plumier/core.HttpStatus.NotFound 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(ctx: Context) {
        await super.execute(ctx)
        const isFile = !!mime.lookup(this.body)
        if (!isFile)
            throw new HttpStatusError(HttpStatus.NotFound)
        ctx.type = extname(this.body)
        const sendFile = ctx.config.sendFile || ((path: string, opt?: ServeStaticOptions) => send(ctx, path, opt))
        await sendFile(this.body, this.opt)
    }
}