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

feat(core-api): expose a list of paginated routes to the plugins when registering api server #3894

Closed
kristjank opened this issue Jul 13, 2020 · 2 comments
Assignees

Comments

@kristjank
Copy link
Contributor

Current Pagination for our core-api endpoints is hardcoded in ext.ts and is not exposed outside of core-api, so that it can be used by plugins.

Expected Behavior

Expose a method that will enable new plugins to register additional routes that require pagination. This can be done when we are registering new api endpoints within the service-provider.ts while a plugin is being loaded.

Current Behaviour

If the endpoints are not registered as paginated, the meta information is not added to API responses.

When registering new endpoints (via plugins), the paginated ones don’t get served in a standard core way with metadata and other info, that is added if the endpoint is listed in ext.ts (registered as paginated endpoint).

Possible Solution

Expose a method that will make it possible to register additional paginated routes when the custom plugins are loaded. A possible way could be via await this.app.get<Server>(identifier).register({ method to add arguments for paginated routes.

https://github.com/ArkEcosystem/core/blob/develop/packages/core-api/src/plugins/pagination/ext.ts#L14-L43

from service-provider.ts

        await this.app.get<Server>(identifier).register({
                    plugin: Handlers,
                    routes: { prefix: "/api/nft", paginated: .{IRoute...}... },
         });

Your Environment

  • Version used: core-v3 / latest develop branch
@air1one
Copy link
Contributor

air1one commented Jul 15, 2020

@kristjank I merged the PR to develop, can you check if that works for you ? Then close this if it does 👌

@air1one
Copy link
Contributor

air1one commented Jul 21, 2020

I'll close this, if this is not fixed feel free to re-open @kristjank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants