// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc(name: "v1", new OpenApiInfo { Title = "Notes API", Version = "v1" }); }); var notesConfiguration = new NotesConfiguration() { FilePath = Configuration[FilePath] }; services.AddScoped(svcs => notesConfiguration); }
public NoteController(NotesConfiguration configuration) { _configuration = configuration; jsonFile = $"{_configuration.FilePath}"; }