/// <summary>
        /// We use orchard-like modular system for asp.net core
        /// </summary>
        private IDefaultPageRewrite CreateDefaultPageRewrite(SpaSettings spaSettings)
        {
            if (_embeddedFileProvider == null)
            {
                throw new InvalidOperationException("Unexpected call to CreateDefaultPageRewrite(). Did you call UseYesSpa() first?");
            }

            var defaultPagePath = spaSettings.EmbeddedUrlRoot.TrimEnd('/'); // for aspnetcore
            var result          = new DefaultPageRewriteAspNetCore(spaSettings.RootUrlPath, defaultPagePath, "index.html", _embeddedFileProvider);

            return(result);
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            this.spaSettings = Configuration.Get <SpaSettings>();

            services.AddControllers();

            services.AddDbContext <BadgererContext>(opt =>
                                                    opt.UseSqlServer(Configuration.GetConnectionString("BadgererDB")));

            services.AddSpaStaticFiles(spa =>
            {
                spa.RootPath = this.spaSettings.StaticFilesRootPath;
            });
        }