LoginSignup
4
2

More than 5 years have passed since last update.

[Angular2] 開発時のCORS対策

Posted at

ng serveを使用した時にCORSの制約でAPIが叩けないときの対策をメモ。。。

json形式で以下のファイルを作成する。

proxy-config.json
{
    "/api": {
        "secure": false, 
        "target": "http://localhost:8080"
    }
}

で、

ng serve --proxy-config proxy.conf.json

を実行。

Angular Cli便利やね〜

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2