Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime applicationLifetime)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // Create default server parameters
            var serverParameters = new HUServerParameters
            {
                DatabaseConfiguration = new HUDatabaseConfiguration()
            };

            // Bind configuration file data to server parameters
            config.Bind(serverParameters);
            // Create a server context from the parameters
            serverContext = HUServerConfigurator.CreateContext(serverParameters);

            // Register shutdown
            applicationLifetime.ApplicationStopping.Register(OnShutdown);

            // Start event loop
            serverContext.EventLoop = new HUEventLoop(serverContext);

            // Load persistent state data
            HUServerConfigurator.LoadState(serverContext, ServerStateStorageFileHUme);

            app.UseOwin(x => x.UseNancy(opt => opt.Bootstrapper = new HUBootstrapper(serverContext)));
        }
Ejemplo n.º 2
0
 public HUBootstrapper(HUServerContext serverContext)
 {
     ServerContext = serverContext;
 }