veeque
Explore posts from serversCDCloudflare Developers
•Created by veeque on 1/20/2025 in #workers-help
Defining RPC methods nicely
Since the methods are pretty big it's nicer to define them in a separate file, but then to add them as RPC methods I do:
Will I really have to define them all by using that "dumb" "self"-call? Also, since I'll likely want the HTTP api to just call the same method instead of having two places that refer to the same function it'd be nice to have it so I have a single source of truth, making the code:
Seems pretty big considering one could (if this didn't have to be a class):
2 replies
CDCloudflare Developers
•Created by veeque on 1/18/2025 in #workers-help
Can Worker Routes be used to host a separate backend on the same domain where the web app is hosted?
Say we have
domain.com
where on app1.domain.com
we host our app. This app has a front-end you'd access by going to app1.domain.com
(or any other sub-domain like app1.domain.com/my/route
). The web-app, a mobile app, or a third-party service might need to fetch data, ideally from app1.domain.com/api/requested/resource
. Can I host the front-end with Workers/Pages on—by default—all routes on that subdomain, but "reserve" /api/*
to be used by a separate worker running the backend code?3 replies
CDCloudflare Developers
•Created by veeque on 1/9/2025 in #workers-help
Is the Workers Build watch path based off the root directory?
5 replies
CDCloudflare Developers
•Created by veeque on 12/29/2024 in #general-help
When Cloudflare mentions "GB" or "MB" do they mean the decimal or binary multiples?
Each Durable Object is allocated 128MB (for billing), so is that 0.128 GB (decimal) or 0.125 GB (binary)?
5 replies
CDCloudflare Developers
•Created by veeque on 11/25/2024 in #general-help
`Registrant State/Province` and `Registrant Country` not redacted
I just ran a
whois
on my domains and in both cases those two fields are not redacted, but they are for the administrative and technical ones. What's up with that?10 replies
CDCloudflare Developers
•Created by veeque on 11/15/2024 in #general-help
Will D1 get jurisdictional restrictions?
I was reading this thread: https://community.cloudflare.com/t/d1-location-hints-explanation-and-improvement/634791
I cannot find any roadmap, so I'm wondering if it's something that has been forgotten
3 replies
CDCloudflare Developers
•Created by veeque on 10/31/2024 in #general-help
How to set up regional services?
5 replies
CDCloudflare Developers
•Created by veeque on 9/11/2024 in #pages-help
How to host multiple pages under the same domain
Let's assume I have a monorepo where each project is a SvelteKit app running on pages. Let's say they run on
app1.pages.dev
, app2.pages.dev
, app3.pages.dev
, and so on.
I now also have a worker that I deploy to handle all this.
Before doing that I have to point out that one page is special, it runs on homepage.pages.dev
and it will be the default page to show (when going to /
, or any other non-app route).
With all that being said:
* When going to /app1
I want to render app1.pages.dev
(also, when going to /app1/literally/anything
I want to render app1.pages.dev/literally/anything
). The same goes for app2
, and any other "custom" route I want
* If this were a switch case, the default would be just rendering the homepage.pages.dev/whatever/happens/to/be/the/uri
What issues I'm facing: I cannot understand how to properly "forward" the url after /app1
and I don't understand how/when assets (the JS, CSS, etc) load properly.
There might be some thing I've tried and either missed or found to be unsuccessful.
Any help would be amazing!3 replies
CDCloudflare Developers
•Created by veeque on 9/10/2024 in #general-help
How to host multiple pages on the same domain
I have a monorepo with 5 applications. Instead of giving each app its own subdomain I would like for one of these to be the home
example.com/
(which might have other routes like /about-us
, /legal
, etc), and all others to be available in example.com/app1
, example.com/app2
, etc. How can I do this?2 replies
CDCloudflare Developers
•Created by veeque on 9/4/2024 in #workers-help
Lower number of requests to SvelteKit app on CF pages
I have a SvelteKit app that I'm deploying using CF pages (or workes? still confusing). However requests to build artifacts (
/_app/*
) still get counted towards the requests usage quota. Is there a way to lower that?
The app is pretty simple:
* Static pages (homepage, contact us, etc)
* SPA pages (the app, hidden behind a login mask so no need for SSR)
* Dynamic routes (my customer's clients go to these eg /vendor/[name]
and they are dynamic).
Ideally it would be nice if the dynamic route gets generated and just statically served afterwards (kind of like ISR), the SPA pages should, ideally, only make requests to a CDN, and the static page should also make a request to a static page. Only the API endpoints actually have a reason to hit the worker itself. How can I configure this?1 replies
DTDrizzle Team
•Created by veeque on 8/30/2024 in #help
How to run a join on the result of a union
I have a union
await union(...)
and I would like to join it with another table. What should I do? Should I put it inside the union query itself (as monsterous as it would become)?3 replies
DTDrizzle Team
•Created by veeque on 8/28/2024 in #help
How can I use returning values when doing a `batch`?
The documentation tells you how to do batches (which are the only way to do what is essentially a transaction on D1): https://orm.drizzle.team/docs/batch-api
The problem is that I have to run the following statements:
As you can see the second one requires the returned id from the previous one to work, and I don't see a way to do this in the batch. What can I do?
3 replies
CDCloudflare Developers
•Created by veeque on 8/19/2024 in #general-help
How can I add a DNS record (dev.*) that points to a preview deployment?
I have a preview deployment with this URL:
dev.[site-name].pages.dev
, so I tried adding a CNAME record dev
that points to dev.[site-name].pages.dev
but navigating to it gives a 522, why's that? the pages.dev url works just fine17 replies
CDCloudflare Developers
•Created by veeque on 8/15/2024 in #general-help
Pages, Workers, Pages functions?
Which does Pages use? I assume "pages functions" but the pricing data is that for "workers"? Can someone please explain to me how all this goes together? The documentation links me all over the place but there is not "graph" I am able to visualise in my mind from all that, mostly due to me having basically just Vercel as hosting experience.
6 replies
How to make a library with Vite's library mode?
I'm in a monorepo scenario and want to make a component library for the shared UI. Since there's not template (although there should really be one, like Svelte's package), how can I go about configuring the newly-made Vite project to export my components?
3 replies