## Overview The library provides a centralized approach for frontend applications to interact with backend services across the [JAX Data Science](https://www.jax.org/research-and-faculty/data-science/tools-and-databases) ecosystem. It eliminates code du
npm install @jax-data-science/api-clientsDesigned primarily for component consumption but usable independently, it ensures consistency and
maintainability as backend services evolve.
``bash`
npm install @jax-data-science/api-clients
> Note: For a complete list of API clients, visit our Demo Application or check the generated documentation.
`typescript
/**
* app.module.ts
*/
...
// MY_SERVICE_CONFIG: injection token used to provide configuration values (like API urls) for MyService
// MyServiceConfig is an interface that defines the structure of the configuration object
import { MY_SERVICE_CONFIG, MyServiceConfig } from '@jax-data-science/api-clients';
...
...
@NgModule({
declarations: [...],
...
providers: [
{
provide(MY_SERVICE_CONFIG, {
useValue: {
baseUrl: 'https://api.example.com', // could also come from environment variables
timeout: 5000, // could also come from environment variables
} as MyServiceConfig
})
}
]
})
`
`typescript
/**
* example.component.ts
*/
import { Component, OnInit } from '@angular/core';
import { MyService } from '@jax-data-science/api-clients';
@Component({
selector: 'app-example',
templateUrl: './example.component.html',
styleUrls: ['./example.component.css']
})
export class ExampleComponent implements OnInit {
data: any;
// Inject MyService into the component
constructor(private myService: MyService) {}
ngOnInit() {
// Use the service to fetch data
this.myService.getData().subscribe(
(response) => {
this.data = response;
},
(error) => {
console.error('Error fetching data:', error);
}
);
}
}
``
- API Clients Development
- Testing & Quality Assurance
- Documentation
- Bug Fixes & Enhancements
Found a bug or have a suggestion? Please email us at: npm@jax.org
When reporting issues please include:
- a clear description of the problem or suggestion
- steps to reproduce (for bugs)
- expected vs. actual behavior
- screenshots or code examples when applicable
- environment details (browser, framework version, etc.)
For detailed release notes and version history, see CHANGELOG.md.
GitHub Repo: jds-ui-components
Maintained By: JAX Data Science
Contact: npm@jax.org
Demo Application: View JDS Components