Interfaces

Project

DefaultDocument

NuGet packageOwin.Framework.DefaultDocument
GitHub sourceOwinFramework.DefaultDocument

Home |  Readme

Rewrites requests for the root of your site to a default document

Adding this middleware to the Owin pipeline

builder.Register(ninject.Get<OwinFramework.DefaultDocument.DefaultDocumentMiddleware>())
    .As("Default document")
    .ConfigureWith(config, "/owinFramework/middleware/defaultDocument");
The assumes that you are using Ninject as your IoC container, and followed the getting started walkthrough. If this is not the case then you will need to adjust the code to work in your application.

Default Configuration

The configuration below is the configuration you will get by default if you do not provide a configuration for this middleware.

{
   "owinFramework": {
      "middleware": {
         "defaultDocument": {
            "documentationRootUrl": "/owin/defaultDocument/config",
            "enabled": true,
            "defaultPage": "/index.html",
            "paths": null
         }
      }
   }
}

To configure default documents for sub-folders you can pass an array of paths like this:

{
   "owinFramework": {
      "middleware": {
         "defaultDocument": {
            "documentationRootUrl": "/owin/defaultDocument/config",
            "enabled": true,
            "defaultPage": "/index.html",
            "paths": [
               { "path": "/ui", "defaultPage": "/ui/index.html" },
               { "path": "/api", "defaultPage": "/api/index.json" }
            ]
         }
      }
   }
}