WWW

Middleware to redirect from/to www subdomain.

Options

add boolean
Default:
false
code 301 302 307 308
Default:
301

Description

This middleware redirects from www. domains to naked (non-www domain) or vice versa.

Installation

This middeware must be used with the Lume's HTTP Server. To use it in production, you need a host running a Deno server, like Deno Deploy.

Create an entry point file (for example, serve.ts) with the following code:

import Server from "lume/core/server.ts";
import www from "lume/middlewares/www.ts";

const server = new Server();

server.use(www({
  add: false, // false to remove, true to add it.
}));

server.start();