renamed http-client to http and fixed tests
This commit is contained in:
parent
e87acb5e18
commit
3d9afd711e
26 changed files with 472 additions and 496 deletions
|
|
@ -18,7 +18,7 @@
|
|||
"@stock-bot/questdb-client": "*",
|
||||
"@stock-bot/mongodb-client": "*",
|
||||
"@stock-bot/event-bus": "*",
|
||||
"@stock-bot/http-client": "*",
|
||||
"@stock-bot/http": "*",
|
||||
"@stock-bot/cache": "*",
|
||||
"hono": "^4.0.0",
|
||||
"ws": "^8.0.0"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Proxy Service
|
||||
|
||||
A comprehensive proxy management service for the Stock Bot platform that integrates with existing libraries (Redis cache, logger, http-client) to provide robust proxy scraping, validation, and management capabilities.
|
||||
A comprehensive proxy management service for the Stock Bot platform that integrates with existing libraries (Redis cache, logger, http) to provide robust proxy scraping, validation, and management capabilities.
|
||||
|
||||
## Features
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ A comprehensive proxy management service for the Stock Bot platform that integra
|
|||
- **Redis Caching**: Stores proxy data with TTL and working status in Redis
|
||||
- **Health Monitoring**: Periodic health checks for working proxies
|
||||
- **Structured Logging**: Comprehensive logging with the platform's logger
|
||||
- **HTTP Client Integration**: Seamless integration with the existing http-client library
|
||||
- **HTTP Client Integration**: Seamless integration with the existing http library
|
||||
- **Background Processing**: Non-blocking proxy validation and refresh jobs
|
||||
|
||||
## Quick Start
|
||||
|
|
@ -25,7 +25,7 @@ await proxyService.startHealthChecks(15 * 60 * 1000); // Health check every 15
|
|||
const proxy = await proxyService.getWorkingProxy();
|
||||
|
||||
// Use the proxy with HttpClient
|
||||
import { HttpClient } from '@stock-bot/http-client';
|
||||
import { HttpClient } from '@stock-bot/http';
|
||||
const client = new HttpClient({ proxy });
|
||||
const response = await client.get('https://api.example.com/data');
|
||||
```
|
||||
|
|
@ -132,7 +132,7 @@ const customSource = {
|
|||
|
||||
```typescript
|
||||
import { proxyService } from './services/proxy.service.js';
|
||||
import { HttpClient } from '@stock-bot/http-client';
|
||||
import { HttpClient } from '@stock-bot/http';
|
||||
|
||||
async function fetchMarketDataWithProxy(symbol: string) {
|
||||
const proxy = await proxyService.getWorkingProxy();
|
||||
|
|
@ -235,7 +235,7 @@ All errors are logged with context and don't crash the service.
|
|||
|
||||
- `@stock-bot/cache`: Redis caching with TTL support
|
||||
- `@stock-bot/logger`: Structured logging with Loki integration
|
||||
- `@stock-bot/http-client`: HTTP client with built-in proxy support
|
||||
- `@stock-bot/http`: HTTP client with built-in proxy support
|
||||
- `ioredis`: Redis client (via cache library)
|
||||
- `pino`: High-performance logging (via logger library)
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ const logger = getLogger('proxy-demo');
|
|||
// if (workingProxies.length > 0) {
|
||||
// console.log('🔄 Example: Using proxy with HttpClient...');
|
||||
// try {
|
||||
// const { HttpClient } = await import('@stock-bot/http-client');
|
||||
// const { HttpClient } = await import('@stock-bot/http');
|
||||
// const proxyClient = new HttpClient({
|
||||
// proxy: workingProxies[0],
|
||||
// timeout: 10000
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Logger } from '@stock-bot/logger';
|
||||
import createCache, { type CacheProvider } from '@stock-bot/cache';
|
||||
import { HttpClient, HttpClientConfig, ProxyConfig , RequestConfig } from '@stock-bot/http-client';
|
||||
import { HttpClient, HttpClientConfig, ProxyConfig , RequestConfig } from '@stock-bot/http';
|
||||
|
||||
export interface ProxySource {
|
||||
url: string;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
"references": [
|
||||
{ "path": "../../libs/config" },
|
||||
{ "path": "../../libs/logger" },
|
||||
{ "path": "../../libs/http-client" },
|
||||
{ "path": "../../libs/http" },
|
||||
{ "path": "../../libs/types" },
|
||||
{ "path": "../../libs/cache" },
|
||||
{ "path": "../../libs/utils" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue