Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tbxark/cloudflare-worker-adapter
Run your script without Cloudflare Workers.
https://github.com/tbxark/cloudflare-worker-adapter
cloudflare cloudflare-workers serverless
Last synced: 3 months ago
JSON representation
Run your script without Cloudflare Workers.
- Host: GitHub
- URL: https://github.com/tbxark/cloudflare-worker-adapter
- Owner: TBXark
- License: mit
- Created: 2022-04-03T04:44:24.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-15T13:07:20.000Z (4 months ago)
- Last Synced: 2024-11-09T05:20:12.345Z (3 months ago)
- Topics: cloudflare, cloudflare-workers, serverless
- Language: TypeScript
- Homepage:
- Size: 622 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cloudflare-worker-adapter
This is a simple Cloudflare Workers adapter that allows this project to run independently without the need for Cloudflare Worker. Currently supported features include:
- TOML configuration file parsing
- Multiple KVNameSpace implementations
- fetch with proxy functionality## Installation
```sh
npm i cloudflare-worker-adapter --save
```## Usage
```typescript
const config: Config = {
port: 8787, // Port to listen on
hostname: '0.0.0.0', // Hostname to listen on
options: {
DATABASE: cache, // Cloudflare Workers bindings
},
config: './test/wrangler.toml', // Path to wrangler.toml
setting: {
baseURL: 'https://example.com', // Base URL for the worker fetch
},
};// Replace the following code with your own code
async function workerFetch(req: Request) {
console.log('Request:', req.url);
return await fetch('https://api.github.com/users/tbxark');
}startServer(config.port, config.hostname, config.config, config.options, config.setting, workerFetch);
```## About
This project is designed to provide a simple Cloudflare Worker runtime for the **ChatGPT-Telegram-Workers** project, and more Cloudflare Worker features may be added in the future. For more detailed usage, please refer to the [ChatGPT-Telegram-Workers](https://github.com/TBXark/ChatGPT-Telegram-Workers) project.## License
**cloudflare-worker-adapter** is released under the MIT license. [See LICENSE](LICENSE) for details.