Permalink
Browse files

RWK Connect Angular App to the Api + Expose Api over port 8080 + Use …

…Cors configuration in Docker Environment
  • Loading branch information...
Vivien FABING
Vivien FABING committed Nov 15, 2017
1 parent 987cc16 commit 5ebcf88c90c7b423facac189007f12a71b90b29f
View
@@ -31,7 +31,7 @@ public void ConfigureServices(IServiceCollection services)
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
if (env.IsDevelopment() || env.EnvironmentName == "Docker")
{
app.UseDeveloperExceptionPage();
app.UseCors(builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());
@@ -1,3 +1,8 @@
<h1>
{{title}}
</h1>
<ul>
<li *ngFor="let value of values">
{{value}}
</li>
</ul>
@@ -1,4 +1,6 @@
import { Component } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
@Component({
selector: 'app-root',
@@ -7,4 +9,24 @@ import { Component } from '@angular/core';
})
export class AppComponent {
title = 'app works!';
API = 'http://localhost:8080';
values: any[] = [];
constructor(private http: Http) { }
ngOnInit() {
this.getValues();
}
getValues() {
this.http.get(`${this.API}/api/values`)
.map(res => res.json())
.subscribe(values => {
console.log(values);
this.values = values;
});
}
}
@@ -5,7 +5,7 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Docker
ports:
- "80"
- "8080:80"
mssql:
environment:
SA_PASSWORD: "YourStrong!Passw0rd"

0 comments on commit 5ebcf88

Please sign in to comment.