Skip to content

Feature/migrate to hono #13

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

Merged
merged 27 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ad7eb74
Initial commit
RobFaustLZ May 21, 2025
84e957c
Adding CORS middleware
RobFaustLZ May 21, 2025
4cad72b
Adding Hyperdrive
RobFaustLZ May 21, 2025
0c9d65f
Adding Hyperdrive
RobFaustLZ May 21, 2025
b77aed1
Adding UrlToZpl functionality
RobFaustLZ May 21, 2025
4a3877a
Adding API reverse proxy
RobFaustLZ May 21, 2025
a8788d2
Adding request logging
RobFaustLZ May 22, 2025
7776953
Migrating environments
RobFaustLZ May 22, 2025
97d44a1
Debugging
RobFaustLZ May 22, 2025
26ba909
Decoupling R2 logging to its own middleware
RobFaustLZ May 22, 2025
c4c989d
Disabling static site
RobFaustLZ May 22, 2025
85c0ebb
Disabling static site
RobFaustLZ May 22, 2025
ceb1ca5
Using `.dev.vars` to connect to localhost for development
RobFaustLZ May 22, 2025
f1e9bb8
Decoupling proxyToBackend handler
RobFaustLZ May 22, 2025
c63394e
Decoupling relative redirects to its own middleware
RobFaustLZ May 22, 2025
77d9d6e
Debugging and code cleanup
RobFaustLZ May 22, 2025
28231ca
Decoupling Hyperdrive to its own middleware
RobFaustLZ May 22, 2025
c216f43
Code cleanup
RobFaustLZ May 22, 2025
c1e0e03
Updating readme
RobFaustLZ May 22, 2025
872fcf9
Attempting to add `Connection` to context variable map
RobFaustLZ May 22, 2025
d6df5bf
Attempting to add `Connection` to context variable map
RobFaustLZ May 22, 2025
f3c1f9c
Code cleanup and documentation
RobFaustLZ May 23, 2025
910977b
Improvements to `hyperdrive` middleware and token verification messaging
RobFaustLZ May 23, 2025
d88a93c
Code cleanup
RobFaustLZ May 23, 2025
c659d17
Merge prep
RobFaustLZ May 23, 2025
902e2eb
Switching from Node 18 to Node 22
RobFaustLZ May 23, 2025
bce10e3
Merge prep
RobFaustLZ May 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
[*.{yaml,yml}]
indent_size = 2
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Use Node.js 18
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '22.x'

- run: npm ci

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
name: Build and Test
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '22.x'
- run: npm ci
- run: npm run build --if-present
- run: npm test
Expand Down
187 changes: 21 additions & 166 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,173 +1,28 @@
# Logs

logs
_.log
npm-debug.log_
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)

report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Runtime data

pids
_.pid
_.seed
\*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

# Coverage directory used by tools like istanbul

coverage
\*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

\*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

\*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variable files

.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)

.cache
.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
node_modules
dist

# Gatsby files

.cache/

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output

.vuepress/dist

# vuepress v2.x temp and cache directory

.temp
.cache

# Docusaurus cache and generated files

.docusaurus

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.\*

# wrangler project

.dev.vars
.wrangler/
junit-report.xml
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# wrangler files
.wrangler
.dev.vars*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.15.0
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 LabelZoom
Copyright (c) 2025 LabelZoom

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,49 @@

[![Build Status](https://github.com/labelzoom/labelzoom-cf-api-proxy/actions/workflows/deploy.yml/badge.svg?branch=main)](https://github.com/labelzoom/labelzoom-cf-api-proxy/actions?query=branch%3Amain)

Cloudflare Worker that serves as a reverse proxy for LabelZoom's public REST API
A Cloudflare Worker that serves as a reverse proxy for LabelZoom's public REST API. This project was bootstrapped using the [React + Vite + Hono + Cloudflare Workers](https://github.com/cloudflare/templates/tree/main/vite-react-template) template.

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/templates/tree/main/vite-react-template)

## Development

Install dependencies:

```bash
npm install
```

Start the development server with:

```bash
npm run dev
```

Your application will be available at [http://localhost:5173](http://localhost:5173).

## Production

Build your project for production:

```bash
npm run build
```

Preview your build locally:

```bash
npm run preview
```

Deploy your project to Cloudflare Workers:

```bash
npx wrangler deploy
```

## Additional Resources

- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)
- [Vite Documentation](https://vitejs.dev/guide/)
- [React Documentation](https://reactjs.org/)
- [Hono Documentation](https://hono.dev/)
28 changes: 28 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
);
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Error | LabelZoom</title>
</head>
<body>
<h1>Oh no!</h1>
<p>If you are seeing this message, it's because we made a mistake. Can you please let us know about it? <a href="https://labelzoom.atlassian.net/servicedesk/customer/portals">LabelZoom Support</a></p>
<p>Click <a href="https://www.labelzoom.net/">here</a> to go to our homepage.</p>
</body>
</html>
14 changes: 14 additions & 0 deletions index.html.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/react-app/main.tsx"></script>
</body>
</html>
Loading
Loading