1.3.9 • Published 6 months ago

cloudflare-worker-adapter v1.3.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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

npm i cloudflare-worker-adapter --save

Usage

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 project.

License

cloudflare-worker-adapter is released under the MIT license. See LICENSE for details.

1.3.7

6 months ago

1.3.6

6 months ago

1.3.5

6 months ago

1.3.9

6 months ago

1.3.8

6 months ago

1.3.4

7 months ago

1.3.3

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.0

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.2.3

10 months ago

1.0.5

10 months ago

1.2.2

10 months ago

1.0.4

10 months ago

1.2.1

10 months ago

1.1.2

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

12 months ago

1.0.0

2 years ago