Code Monkey home page Code Monkey logo

Comments (7)

pablorsk avatar pablorsk commented on August 29, 2024 2

Oh! ok....

I'm thinking on a feature... We can atach new method on service for specials URIs, o just a particular service base url... 🤔

from ngx-jsonapi.

ZeevKatz avatar ZeevKatz commented on August 29, 2024 2

Created new pull request with solution for this issue.
Waiting for your merge...

from ngx-jsonapi.

pablorsk avatar pablorsk commented on August 29, 2024

hi @ZeevKatz,

yeap! you can do with any service. For example:

@Injectable()
export class AuthorsService extends Service<Author> {
    public resource = Author;
    public type = 'authors';
    public schema: ISchema = {
        relationships: {
            photos: {
                hasMany: true
            }
        }
    };

    public getPath(): string {
        return 'my_particular_path_for_this_resource_type';
    }
}

from ngx-jsonapi.

ZeevKatz avatar ZeevKatz commented on August 29, 2024

Maybe I was uncleared, I'd like to change the api host and not a specific service path.

from ngx-jsonapi.

ZeevKatz avatar ZeevKatz commented on August 29, 2024

Hi @pablorsk,
Please let me know if there are issues with my last pull request that related to this issue.
Jan 30 was really far from now and this is a really important change,
Thanks.

from ngx-jsonapi.

valentasm1 avatar valentasm1 commented on August 29, 2024

I am not sure if i am not too late for possible solution. But maybe it will help for someone one day. Use case is to have one api url for deployment and other for prod. Also not 100% clear that it gonna work for all but you'll get idea.

Create folder under root "environments" with two files
environment.ts

export const environment = {
  production: false,
  someEndpoint : 'http://localhost:55180/',
  anotherEndPoint : "http://localhost:55009/x-files/"
};

environment.prod.ts

export const environment = {
  production: true,
  someEndpoint : 'http://api.superdomain.com/',
  anotherEndPoint : "http://api.superdomain.com/no-files/"
};

And then in you service you could use

private rootUrl = environment.someEndpoint + "x-files-documents/";
public getPath(): string {
	return this.rootUrl;
}

So when you build with flag prod it gonna take variables from prod file. Easy peasy.

from ngx-jsonapi.

pablorsk avatar pablorsk commented on August 29, 2024

In Multinexo, @valentasm1, we have a very similar code.

from ngx-jsonapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.