Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j-hoplin/puppeteer-pool-api
Puppeteer Pool managing (For Linkit PoC)
https://github.com/j-hoplin/puppeteer-pool-api
Last synced: about 1 month ago
JSON representation
Puppeteer Pool managing (For Linkit PoC)
- Host: GitHub
- URL: https://github.com/j-hoplin/puppeteer-pool-api
- Owner: J-Hoplin
- Created: 2024-08-25T14:20:44.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-28T17:29:14.000Z (4 months ago)
- Last Synced: 2024-12-02T18:12:07.770Z (about 1 month ago)
- Language: TypeScript
- Homepage:
- Size: 375 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Puppeteer Pool Manager
**Example Repository of [`@hoplin/puppeteer-pool`](https://github.com/J-Hoplin/Puppeteer-Pool)**
## Routes
- `POST /`
- Body: `{ url: url }`
- `GET /health`
- Get ping
- `GET /health/metrics`
- GET application metrics and puppeteer pool metrics## Usage Example
Example of combining pool manager with Express Framework
```typescript
import {
bootPoolManager,
controlSession,
getPoolMetrics,
} from '(Manager Import path)';async function bootstrap() {
/**
* Initialize Express Server
*/// Initialize pool
await bootPoolManager({Puppeteer Launch Options},'Puppeteer Pool Config Path');// Control Session example
server.post('/', async (req, res) => {
const url = req.body.url;// Get single session from pool
const controlResponse = await controlSession(async (session) => {
/**
* Control session here
*/
return; //(Some values)
});
return res.status(200).json({ result: controlResponse });
});server.get('/', async (req, res) => {
const puppeteerPoolMetrics = await getPoolMetrics();
return res.status(200).json(puppeteerPoolMetrics);
});/**
* Some other routers and start server
*/
}
```