#How can I connect the Laravel 11 API to Angular 18?

15 messages ยท Page 1 of 1 (latest)

dire frost
#

this is the error

frail saddle
silk steppe
#

Have you tried?

php artisan config:publish cors

And then in config/cors.php add http://localhost:4200 in allowed_origins?

trail hound
dire frost
#

this is my CORS file

trail hound
#

try this

    'paths' => ['api/*', 'sanctum/csrf-cookie'],
    'allowed_methods' => ['*'],
    'allowed_origins' => ['*'],
    'allowed_origins_patterns' => [],
    'allowed_headers' => ['*'],
    'exposed_headers' => [],
    'max_age' => 0,
    'supports_credentials' => false,
];
dire frost
#

this is what the errors says

trail hound
#

did u try my code?

dire frost
#

I did

trail hound
#

maybe cache

#

try this php artisan config:cache

dire frost
#

this is my app.php in bootstrap file do you think theres something wrong here?

trail hound
#

or change this 'paths' => ['foodly-api/api/*', 'sanctum/csrf-cookie'],

trail hound
#

looks like the problem is solved ๐Ÿ˜ƒ

dire frost
#

the error is still there ๐Ÿ˜ฆ