veeque
veeque
Explore posts from servers
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?
No description
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
HHono
Created by veeque on 9/11/2024 in #help
How do I get rest params?
Take the following app:
import { Hono } from "hono";
import { trimTrailingSlash } from "hono/trailing-slash";

const app = new Hono();

app.use(trimTrailingSlash());

app.get("/", async (c) => {
return c.text("This is the Cloudflare page for /");
});

app.get("/app/:app/*", async (ctx) => {
return ctx.text(
`You have requested the ${ctx.req.param(
"app"
)} application on the "${ctx.req.param("*")}" path`
);
});

export default app;
import { Hono } from "hono";
import { trimTrailingSlash } from "hono/trailing-slash";

const app = new Hono();

app.use(trimTrailingSlash());

app.get("/", async (c) => {
return c.text("This is the Cloudflare page for /");
});

app.get("/app/:app/*", async (ctx) => {
return ctx.text(
`You have requested the ${ctx.req.param(
"app"
)} application on the "${ctx.req.param("*")}" path`
);
});

export default app;
It would be nice if this worked, but doing ctx.req.param("*") doesn't give you the remaining params. I need this as I have to forward those to a separate Cloudflare pages application.
2 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:
const returned = await db
.insert(schema.universities)
.values({ handle: form.data.handle })
.returning({ id: schema.universities.id });

await db.insert(schema.localizedUniversityNames).values({
university: returned[0].id,
languageTag: form.data.languageTag,
name: form.data.name,
});
const returned = await db
.insert(schema.universities)
.values({ handle: form.data.handle })
.returning({ id: schema.universities.id });

await db.insert(schema.localizedUniversityNames).values({
university: returned[0].id,
languageTag: form.data.languageTag,
name: form.data.name,
});
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 fine
17 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
SSolidJS
Created by veeque on 1/30/2024 in #support
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
SSolidJS
Created by veeque on 1/9/2024 in #support
Building app for static file hosting
Is it possible to build a Solid Start app such that it can be hosted on a static file hosting platform? Since I'm not using ssr, and have set start.ssr to false, I really don't see why I should build for a node server. Is there any way to change it?
12 replies