Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IPriceService priceService)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "CryptoService v1"));
            }

            app.UseCors(CorsPolicy);

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            // This is not the best place or the best way to update the list of valid coins.
            // This resulted from (incorrectly) assuming only three types of coins should be supported
            // during the design stage. Going forward with this now due to time constraints.
            CoinStore.AddCoinsToStore(priceService.GetAllValidCoins().GetAwaiter().GetResult());
        }