Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the backend-uri configurable #148

Open
JocaPC opened this issue Nov 4, 2018 · 0 comments
Open

Make the backend-uri configurable #148

JocaPC opened this issue Nov 4, 2018 · 0 comments

Comments

@JocaPC
Copy link

JocaPC commented Nov 4, 2018

I'm working on Microsoft SQL Server and I want to create Angular demo app that shows how to implement it end-to-end solution using real backend (.Net) and database (SQL Server). Current version is here: https://github.com/JocaPC/sql-server-samples/tree/angular-tour-of-heroes/src/

I have used this code as front-end, I have created back-end/database, and everything is working fine.

However, the problem is that I had to do few source code changes to make it work, and it would be nicer if these are some config values that can be changed instead of chaining the code. The changes that I made are:

  1. Add the backendUri in environment config: https://github.com/JocaPC/sql-server-samples/blob/angular-tour-of-heroes/src/frontend/src/environments/environment.ts#L8
  2. Change the backend URL in the code: https://github.com/JocaPC/sql-server-samples/blob/angular-tour-of-heroes/src/frontend/src/app/hero.service.ts#L11
  3. Change the backend URL in search service https://github.com/JocaPC/sql-server-samples/blob/angular-tour-of-heroes/src/frontend/src/app/hero-search.service.ts#L15
  4. Disable in-memory data source here: https://github.com/JocaPC/sql-server-samples/blob/angular-tour-of-heroes/src/frontend/src/app/app.module.ts#L24

It works for me but it would be good if the backend URL is placed in the config in your code too because I believe that other people will like to do the same. Also, it would be good do if we could disable InMemoryDataService without changing the code. Ideally this could be some property that could be changed if I deploy the app in Azure Web Apps.

If you know have some better way to re-configure this sample to work with some backend, could you point me to some instruction in docs? Otherwise what do you think about adding this in your code? I can send the PR for backendUri if you agree, but I'm not sure what would be the best way to disable InMemoryDataSource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant