diff --git a/.env b/.env
new file mode 100644
index 0000000..0dd6bde
--- /dev/null
+++ b/.env
@@ -0,0 +1 @@
+PORT=4321
\ No newline at end of file
diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml
new file mode 100644
index 0000000..02b915b
--- /dev/null
+++ b/.idea/git_toolbox_prj.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 0000000..d23208f
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..9a8f42e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,17 @@
+FROM oven/bun
+
+WORKDIR /app
+
+COPY package.json .
+COPY bun.lockb .
+
+RUN bun install --production
+
+COPY src src
+COPY tsconfig.json .
+# COPY public public
+
+ENV NODE_ENV production
+CMD ["bun", "src/index.ts"]
+
+EXPOSE 4444
\ No newline at end of file
diff --git a/bun.lockb b/bun.lockb
new file mode 100644
index 0000000..74937b3
Binary files /dev/null and b/bun.lockb differ
diff --git a/package.json b/package.json
index bcf9248..755ea3b 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,8 @@
"dev": "bun run --watch src/index.ts"
},
"dependencies": {
- "elysia": "latest"
+ "elysia": "latest",
+ "elysia-rate-limit": "^4.1.0"
},
"devDependencies": {
"bun-types": "latest"
diff --git a/src/index.ts b/src/index.ts
index 9c1f7a1..bb3bbd4 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,7 +1,28 @@
-import { Elysia } from "elysia";
+import {Elysia} from "elysia";
+import {rateLimit} from "elysia-rate-limit";
-const app = new Elysia().get("/", () => "Hello Elysia").listen(3000);
+const url =
+ "https://script.google.com/macros/s/AKfycbwHGQjf1vlKbY7UJ3h1OUTywJCgma6SlJi94WXaFBhS_93cdfHhIB0mVQBHqHRtbO4dQQ/exec";
+
+
+const app = new Elysia()
+ .use(rateLimit({
+ max: 2
+ }))
+
+ .post("/", async ({body}) => {
+ const response = await fetch(url, {
+ method: "POST",
+ body: JSON.stringify(body),
+ headers: {"Content-Type": "application/json"},
+ })
+
+
+ return await response.json()
+ })
+
+ .listen(process.env.PORT ?? 4444);
console.log(
- `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
+ `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);