-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1c8eec
commit f171abe
Showing
14 changed files
with
118 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,5 @@ testem.log | |
.DS_Store | ||
Thumbs.db | ||
|
||
.nx/cache | ||
.nx/cache | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/swcrc", | ||
"jsc": { | ||
"target": "es2022", | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true, | ||
"dynamicImport": true | ||
}, | ||
"transform": { | ||
"decoratorMetadata": true, | ||
"legacyDecorator": true | ||
}, | ||
"keepClassNames": true, | ||
"externalHelpers": false, | ||
"loose": true | ||
}, | ||
"module": { | ||
"type": "es6", | ||
"strictMode": true, | ||
"noInterop": false | ||
}, | ||
"minify": true, | ||
"sourceMaps": false, | ||
"exclude": [ | ||
"vite.config.ts", | ||
".*\\.spec.tsx?$", | ||
".*\\.test.tsx?$", | ||
"./src/vite-setup.ts$", | ||
"./**/vite-setup.ts$", | ||
".*.js$", | ||
"./**/__tests__/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { handle } from "hono/vercel"; | ||
import { app } from "./main.js"; | ||
|
||
export default handle(app); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,27 @@ | ||
import { serve } from "@hono/node-server"; | ||
import { kv } from "@vercel/kv"; | ||
import { Hono } from "hono"; | ||
import { type RateLimitInfo, rateLimiter } from "hono-rate-limiter"; | ||
import { logger } from "hono/logger"; | ||
import Page from "./Page"; | ||
|
||
// Init the app | ||
const app = new Hono<{ | ||
Variables: { | ||
rateLimit: RateLimitInfo; | ||
}; | ||
}>(); | ||
|
||
// Adding the rate limitter | ||
app.use( | ||
logger(), | ||
rateLimiter({ | ||
windowMs: 10_000, | ||
limit: 10, | ||
// store: new RedisStore({ | ||
// sendCommand: (...args: string[]) => kv.eval(...args), | ||
// }), | ||
handler: (_, next) => next(), | ||
}), | ||
); | ||
|
||
// Routes | ||
app.get("/", (c) => c.html(<Page info={c.get("rateLimit")} />)); | ||
|
||
// Serving the app | ||
const port = Number(process.env.PORT) || 3000; | ||
console.log(`Server is running on port ${port}`); | ||
|
||
serve({ | ||
fetch: app.fetch, | ||
port, | ||
}); | ||
import { Hono } from "hono"; | ||
import { type RateLimitInfo, rateLimiter } from "hono-rate-limiter"; | ||
import { logger } from "hono/logger"; | ||
import Page from "./Page.js"; | ||
|
||
// Init the app | ||
export const app = new Hono<{ | ||
Variables: { | ||
rateLimit: RateLimitInfo; | ||
}; | ||
}>(); | ||
|
||
// Adding the rate limitter | ||
app.use( | ||
logger(), | ||
rateLimiter({ | ||
windowMs: 10_000, | ||
limit: 10, | ||
// store: new RedisStore({ | ||
// sendCommand: (...args: string[]) => kv.eval(...args), | ||
// }), | ||
handler: (_, next) => next(), | ||
}), | ||
); | ||
|
||
// Routes | ||
app.get("/", (c) => c.html(<Page info={c.get("rateLimit")} />)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "module", | ||
"dependencies": { | ||
"hono": "^4.1.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
} | ||
], | ||
"compilerOptions": { | ||
"esModuleInterop": true | ||
} | ||
"module": "esnext", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"target": "ESNext", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "hono/jsx", | ||
"outDir": "../../dist/out-tsc", | ||
"declaration": true | ||
}, | ||
|
||
"include": ["api/**/*.ts", "api/**/*.tsx"], | ||
"exclude": [ | ||
"vite.config.ts", | ||
"api/**/*.spec.ts", | ||
"api/**/*.test.ts", | ||
"./**/__tests__/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"rewrites": [ | ||
{ | ||
"source": "/(.*)", | ||
"destination": "/api" | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.