Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deno routing to try to make existing cloudflare code run #773

Merged
merged 52 commits into from
Jan 9, 2025

Conversation

tarasglek
Copy link
Owner

@tarasglek tarasglek commented Jan 8, 2025

This is a bunch of hacks to make existing cloudflare code run in Deno.

Main problem is file-system routing, we'll need to convert this to static routing some day. Also need to fix imports some day. For now this can run with smallweb/deno locally, but not on deno deploy due to needing sloppy imports and "dynamic" fs routing.

Copy link

cloudflare-workers-and-pages bot commented Jan 8, 2025

Deploying chatcraft-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: a0b4313
Status: ✅  Deploy successful!
Preview URL: https://4ed37eee.console-overthinker-dev.pages.dev
Branch Preview URL: https://taras-deno-routing.console-overthinker-dev.pages.dev

View logs

@tarasglek
Copy link
Owner Author

tarasglek commented Jan 8, 2025

@humphd what do you think about enabling these ts options https://2ality.com/2025/01/nodejs-strip-type.html#tsconfig.json and switching stuff in api/ to using extensions?

I mean just:

"allowImportingTsExtensions": true,
 "rewriteRelativeImportExtensions": true,

@tarasglek
Copy link
Owner Author

Here is why the current mapping looks like

Route: /api/share/:user_id? -> file:///home/taras/smallweb/chatcraft/functions/api/share/[[user_id]].ts
Route: /api/share/:user -> file:///home/taras/smallweb/chatcraft/functions/api/share/[user].ts
Route: /api/proxy -> file:///home/taras/smallweb/chatcraft/functions/api/proxy.ts
Route: /api/logout -> file:///home/taras/smallweb/chatcraft/functions/api/logout.ts
Route: /api/login -> file:///home/taras/smallweb/chatcraft/functions/api/login.ts

I would love to have these routes to be static and code inside to be maximally standard js

@tarasglek tarasglek merged commit 747d102 into main Jan 9, 2025
4 checks passed
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.

1 participant