···11+/**
22+ * Welcome to Cloudflare Workers! This is your first worker.
33+ *
44+ * - Run `npm run dev` in your terminal to start a development server
55+ * - Open a browser tab at http://localhost:8787/ to see your worker in action
66+ * - Run `npm run deploy` to publish your worker
77+ *
88+ * Bind resources to your worker in `wrangler.jsonc`. After adding bindings, a type definition for the
99+ * `Env` object can be regenerated with `npm run cf-typegen`.
1010+ *
1111+ * Learn more at https://developers.cloudflare.com/workers/
1212+ */
1313+1414+export default {
1515+ async fetch(request, env, ctx): Promise<Response> {
1616+ /*const url = new URL(request.url);
1717+ const proxyUrl = new URL(request.url);
1818+ proxyUrl.host = "rocksky.apidog.io";
1919+ proxyUrl.hostname = "rocksky.apidog.io";
2020+ // set headers
2121+ const headers = new Headers(request.headers);
2222+ headers.set("X-Apidog--Docs-Site-ID", "rocksky");
2323+ return fetch(proxyUrl.toString(), {
2424+ method: request.method,
2525+ headers,
2626+ });*/
2727+2828+ // redirect to fmqouwwzmr.apidog.io
2929+ return Response.redirect("https://docs.rocksky.app", 301);
3030+ },
3131+} satisfies ExportedHandler<Env>;
+25
rockskyapi/rocksky-doc/test/index.spec.ts
···11+// test/index.spec.ts
22+import { env, createExecutionContext, waitOnExecutionContext, SELF } from 'cloudflare:test';
33+import { describe, it, expect } from 'vitest';
44+import worker from '../src/index';
55+66+// For now, you'll need to do something like this to get a correctly-typed
77+// `Request` to pass to `worker.fetch()`.
88+const IncomingRequest = Request<unknown, IncomingRequestCfProperties>;
99+1010+describe('Hello World worker', () => {
1111+ it('responds with Hello World! (unit style)', async () => {
1212+ const request = new IncomingRequest('http://example.com');
1313+ // Create an empty context to pass to `worker.fetch()`.
1414+ const ctx = createExecutionContext();
1515+ const response = await worker.fetch(request, env, ctx);
1616+ // Wait for all `Promise`s passed to `ctx.waitUntil()` to settle before running test assertions
1717+ await waitOnExecutionContext(ctx);
1818+ expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`);
1919+ });
2020+2121+ it('responds with Hello World! (integration style)', async () => {
2222+ const response = await SELF.fetch('https://example.com');
2323+ expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`);
2424+ });
2525+});
···11+{
22+ "compilerOptions": {
33+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
44+55+ /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
66+ "target": "es2021",
77+ /* Specify a set of bundled library declaration files that describe the target runtime environment. */
88+ "lib": ["es2021"],
99+ /* Specify what JSX code is generated. */
1010+ "jsx": "react-jsx",
1111+1212+ /* Specify what module code is generated. */
1313+ "module": "es2022",
1414+ /* Specify how TypeScript looks up a file from a given module specifier. */
1515+ "moduleResolution": "Bundler",
1616+ /* Specify type package names to be included without being referenced in a source file. */
1717+ "types": [
1818+ "@cloudflare/workers-types/2023-07-01"
1919+ ],
2020+ /* Enable importing .json files */
2121+ "resolveJsonModule": true,
2222+2323+ /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
2424+ "allowJs": true,
2525+ /* Enable error reporting in type-checked JavaScript files. */
2626+ "checkJs": false,
2727+2828+ /* Disable emitting files from a compilation. */
2929+ "noEmit": true,
3030+3131+ /* Ensure that each file can be safely transpiled without relying on other imports. */
3232+ "isolatedModules": true,
3333+ /* Allow 'import x from y' when a module doesn't have a default export. */
3434+ "allowSyntheticDefaultImports": true,
3535+ /* Ensure that casing is correct in imports. */
3636+ "forceConsistentCasingInFileNames": true,
3737+3838+ /* Enable all strict type-checking options. */
3939+ "strict": true,
4040+4141+ /* Skip type checking all .d.ts files. */
4242+ "skipLibCheck": true
4343+ },
4444+ "exclude": ["test"],
4545+ "include": ["worker-configuration.d.ts", "src/**/*.ts"]
4646+}
···11+// Generated by Wrangler
22+// After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
33+interface Env {
44+}
+47
rockskyapi/rocksky-doc/wrangler.jsonc
···11+/**
22+ * For more details on how to configure Wrangler, refer to:
33+ * https://developers.cloudflare.com/workers/wrangler/configuration/
44+ */
55+{
66+ "$schema": "node_modules/wrangler/config-schema.json",
77+ "name": "white-scene-4cbd",
88+ "main": "src/index.ts",
99+ "compatibility_date": "2025-03-03",
1010+ "observability": {
1111+ "enabled": true
1212+ }
1313+ /**
1414+ * Smart Placement
1515+ * Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
1616+ */
1717+ // "placement": { "mode": "smart" },
1818+1919+ /**
2020+ * Bindings
2121+ * Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
2222+ * databases, object storage, AI inference, real-time communication and more.
2323+ * https://developers.cloudflare.com/workers/runtime-apis/bindings/
2424+ */
2525+2626+ /**
2727+ * Environment Variables
2828+ * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
2929+ */
3030+ // "vars": { "MY_VARIABLE": "production_value" },
3131+ /**
3232+ * Note: Use secrets to store sensitive data.
3333+ * https://developers.cloudflare.com/workers/configuration/secrets/
3434+ */
3535+3636+ /**
3737+ * Static Assets
3838+ * https://developers.cloudflare.com/workers/static-assets/binding/
3939+ */
4040+ // "assets": { "directory": "./public/", "binding": "ASSETS" },
4141+4242+ /**
4343+ * Service Bindings (communicate between multiple Workers)
4444+ * https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
4545+ */
4646+ // "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
4747+}