This class represents a new Slsy singleton for you to use in your Oak application as a middleware. Slsy is designed to handle HTTP security headers inside your Oak application.
▶Use the slsy middleware in an Oak application server
Use the slsy middleware in an Oak application server
import { Application, Context, Next } from "@oak/oak"; import { Slsy } from "@ventgrey/slsy"; const app: Application = new Application(); const slsy: Slsy = new Slsy({ hidePoweredBy: { setTo: "Deno-saurius", }, ienoopen: true, }); app.use((ctx: Context, next: Next) => { ctx.response = slsy.slsy(ctx.request, ctx.response); next(); }); app.use((ctx: Context) => { ctx.response.body = { message: "Hello JSR fellas!" }; });
new
Slsy(options?: SLSyOptions)
Initializes a new instance of the class with the specified options.
private
options: SLSyOptions
The options object to pass to the Slsy class.
slsy(request: Request,response: Response,): Response
Calls various middleware functions based on the provided options and returns the response.