Created
August 21, 2015 01:30
-
-
Save dcomartin/767273cc2fe6e7bdf2ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
public void Configuration(IAppBuilder app) | |
{ | |
// Configure Web API for self-host. | |
var config = new HttpConfiguration(); | |
config.Routes.MapHttpRoute( | |
name: "DefaultApi", | |
routeTemplate: "api/{controller}/{id}", | |
defaults: new { id = RouteParameter.Optional } | |
); | |
// Adding to the pipeline with our own middleware | |
app.Use(async (context, next) => | |
{ | |
// Add Header | |
context.Response.Headers["X-Powered-By"] = "Owin Self Host"; | |
// Call next middleware | |
await next.Invoke(); | |
}); | |
// Custom Middleare | |
app.Use(typeof(CustomMiddleware)); | |
// Web Api | |
app.UseWebApi(config); | |
// Fik | |
var options = new FileServerOptions | |
{ | |
EnableDirectoryBrowsing = true, | |
EnableDefaultFiles = true, | |
DefaultFilesOptions = { DefaultFileNames = {"index.html"}}, | |
FileSystem = new PhysicalFileSystem("Assets"), | |
StaticFileOptions = { ContentTypeProvider = new CustomContentTypeProvider() } | |
}; | |
app.UseFileServer(options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment