hung-max-api
v0.0.5
Published
Max API package for HungPlatform
Downloads
10
Maintainers
Readme
@hungplatform/max-api
A TypeScript library for API communication in the HungPlatform micro-frontend architecture.
Installation
npm install @hungplatform/max-apiUsage
import MaxApi, { MaxApiConfig } from '@hungplatform/max-api';
const config: MaxApiConfig = {
baseUrl: 'https://api.example.com',
timeout: 5000,
headers: {
Authorization: 'Bearer token',
},
};
const api = new MaxApi(config);
// Example API calls
const data = await api.get('/users');
const result = await api.post('/users', { name: 'John Doe' });Development
# Build the package
npm run build
# Run tests
npm test
# Type check
npm run type-check
# Lint code
npm run lintAPI Reference
MaxApiConfig
baseUrl: string - The base URL for API requeststimeout?: number - Request timeout in millisecondsheaders?: Record<string, string> - Default headers for requests
MaxApi
get(endpoint: string): Promise<any>- Perform GET requestpost(endpoint: string, data: any): Promise<any>- Perform POST request
