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

Cors fix #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pw/pw-jwt-oauth/client/src/app/services/newsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export class NewsService {
constructor(private http: HttpClient) {}

getNews(): Observable<News[]> {
return this.http.get<News[]>('/api/news');
let headers= new HttpHeaders({'Content-Type': 'application/json'});
let _url_ = 'http://localhost:8080/api/news';
return this.http.get<News[]>(_url_, {headers: headers})
//return this.http.get<News[]>('/api/news');
}

addLike(news: News) {
Expand Down
14 changes: 7 additions & 7 deletions pw/pw-jwt-oauth/server/src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ jhipster:
max-pool-size: 50
queue-capacity: 10000
# By default CORS is disabled. Uncomment to enable.
#cors:
#allowed-origins: "*"
#allowed-methods: GET, PUT, POST, DELETE, OPTIONS
#allowed-headers: "*"
#exposed-headers:
#allow-credentials: true
#max-age: 1800
cors:
allowed-origins: http://localhost:9000
allowed-methods: GET, PUT, POST, DELETE, OPTIONS
allowed-headers: "*"
exposed-headers:
allow-credentials: true
max-age: 1800
mail:
from: bookstore@localhost
ribbon:
Expand Down