Skip to content

docs: add deno server example to the README#57

Merged
kentonv merged 3 commits intocloudflare:mainfrom
sigmaSd:patch-1
Sep 27, 2025
Merged

docs: add deno server example to the README#57
kentonv merged 3 commits intocloudflare:mainfrom
sigmaSd:patch-1

Conversation

@sigmaSd
Copy link
Contributor

@sigmaSd sigmaSd commented Sep 25, 2025

if I uncomment headers it gives this type error

TS2353 [ERROR]: Object literal may only specify known properties, and 'headers' does not exist in type 'RpcSessionOptions'.
        headers: { "Access-Control-Allow-Origin": "*" }, // TODO: this is a type error
        ~~~~~~~
    at file:///home/mrcool/dev/deno/lab/zz/a.ts:26:9

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Sep 25, 2025

Maybe the request should be updated instead if this function really doesn't accept headers

      // If you are accepting WebSockets, then you might as well accept cross-origin HTTP, since
      // WebSockets always permit cross-origin request anyway. But, see security considerations
      // for further discussion.
      const headers = new Headers(req.headers);
      headers.set("Access-Control-Allow-Origin", "*");
      const updatedReq = new Request(req, { headers });
      return newHttpBatchRpcResponse(updatedReq, new MyApiImpl());

sigmaSd and others added 2 commits September 26, 2025 05:24
Co-authored-by: Kenton Varda <kenton@cloudflare.com>
@sigmaSd
Copy link
Contributor Author

sigmaSd commented Sep 26, 2025

I updated the code as you suggested

@kentonv kentonv merged commit 7c4207a into cloudflare:main Sep 27, 2025
@kentonv
Copy link
Member

kentonv commented Sep 27, 2025

Thank you!

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Sep 27, 2025

Thank you as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants