Startup.cs

45 lines | 1.091 kB Blame History Raw Download
using Microsoft.Owin;

[assembly: OwinStartup(typeof(Web.Startup))]
namespace Web
{
    using System.Web.Hosting;
    using Microsoft.Owin.FileSystems;
    using Microsoft.Owin.StaticFiles;
    using Owin;
    using DotVVM.Framework.Routing;

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var applicationPhysicalPath = HostingEnvironment.ApplicationPhysicalPath;

            ConfigureAuth(app);

            var dotVvmConfiguration = app.UseDotVVM<DotVvmStartup>(applicationPhysicalPath, debug: IsInDebugMode());
            dotVvmConfiguration.AssertConfigurationIsValid();
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileSystem = new PhysicalFileSystem(applicationPhysicalPath)
            });

            if (IsInDebugMode()) 
            {
                app.UseDotvvmHotReload();
            }
        }
        public void ConfigureAuth(IAppBuilder app)
        {
        }

        private bool IsInDebugMode()
        {
#if !DEBUG
            return false;
#endif
            return true;
        }
    }
}