Vheissu / aurelia-for-real-world-web-applications-book-feedback

Post feedback as issues here on Github for the Aurelia book. Be as descriptive and honest as you like.
15 stars 0 forks source link

Book samples - Best way to have a config file #92

Open oteuan opened 8 years ago

oteuan commented 8 years ago

Hi Dwayne!

First of all, I wanted to congratulate you for the book. I am really enjoying reading it, although now it is being a bit dificult with my little one ;)

I was wondering if you have the samples in the book somewhere in git. It would be very helpful to have maybe some projects with them up and running.

I do apologize if this content is already in the book but I am trying to have a configuration file, like a appsettings.json file in the new ASP.NET, where I could store my settings. I came up with your aurelia-configuration plugin but i cannot make it work. I am having the 'configure.js:175 Configuration file could not be found or loaded: config/config.json' error once and once again. Actually, I would like to reuse the appsettings file but for the moment I am just trying to avoid the error. I have an aspnetcore project with Aurelia and webpack. I have tried to load the config.json file from different locations: first I had the config/config.json under my wwwroot and after I move it at the same level of my web.config without success. Could you please advice? -UIProject ---(temporal config folder with config.json inside) ---web.config ---appsettings.json ---wwwroot -----(temporal config folder with config.json inside)

As I said, I would like to reuse that appsettings.json file if possible.

Thanks!

elmt1 commented 7 years ago

Hi Oteuan,

I am not Dwayne but one way to access your appsettings.json in asp.net would be to inject it into a controller and create a Web method to return the values. There is an example of that here: Configuration in ASP.NET Core

Search for HomeController and you will see an example that shows how to inject an IOptions object with the appsettings.json values and return it from a Web method.