jadjoubran / laravel-angular

(deprecated) Laravel & Angular package
https://laravel-angular.io
MIT License
179 stars 25 forks source link

Awesome job #3

Closed lakinmohapatra closed 6 years ago

lakinmohapatra commented 6 years ago

You guys are doing good work .

Keep up good work.

We are waiting for new features

jadjoubran commented 6 years ago

Thanks @lakinmohapatra I'm glad you like it 😄 What are some features that you expect to see in this package? Keeping in mind that they should be useful for most of the users, rather than specific use cases

ianrussel commented 6 years ago

How would you call endpoints without using the full url of laravel?

Example

This does not work

    getAll(): Observable {
        return this.http
           .get('api/posts')
           .map(response => response.json());
    }

This works

     getAll(): Observable {
         return this.http
            .get('http://laravel.dev/api/posts')
            .map(response => response.json());
     }

Project structure

    app
    bootstrap
    angular
       e2e
       node_modules
       src
           app
           assets
           .......

    config
    database
    public
    resources

Correct me if I am wrong, is the goal of this package is to use angular and laravel as a single project, in same domain, deploy to production not as a separate files?

Thanks

jadjoubran commented 6 years ago

Hi @ianrussel Yes the only way is to always prePend the base URL. The goal of this package is to make it easier to use Laravel & Angular but not necessarily in a single project. I'd recommend separating them but you could decide to combine them.

However in order to solve your problem, I'd recommend creating your own API class that wraps the fetch API and automatically uses the base URL, here's a gist to implement that:

jadjoubran commented 6 years ago

https://gist.github.com/jadjoubran/0f984f0eb19c6ab46057cced09440d42