|
1 | 1 | import { Hono } from "hono"; |
2 | | -import { describeRoute, resolver, validator as zValidator } from "hono-openapi"; |
3 | | -import { createExecuteHandler } from "@/handlers"; |
4 | | -import { executeRequestSchema, executeResponseSchema } from "@/schemas"; |
| 2 | +import { runRouter } from "./run"; |
5 | 3 |
|
6 | 4 | const app = new Hono(); |
7 | 5 |
|
8 | | -app.post( |
9 | | - "/python", |
10 | | - describeRoute({ |
11 | | - operationId: "executePython", |
12 | | - description: "Execute Python code", |
13 | | - responses: { |
14 | | - 200: { |
15 | | - description: "Successful execution", |
16 | | - content: { |
17 | | - "application/json": { |
18 | | - schema: resolver(executeResponseSchema), |
19 | | - }, |
20 | | - }, |
21 | | - }, |
22 | | - }, |
23 | | - }), |
24 | | - zValidator("json", executeRequestSchema), |
25 | | - createExecuteHandler("python"), |
26 | | -); |
| 6 | +app.route("/run", runRouter) |
27 | 7 |
|
28 | | -app.post( |
29 | | - "/javascript", |
30 | | - describeRoute({ |
31 | | - operationId: "executeJavaScript", |
32 | | - description: "Execute JavaScript code", |
33 | | - responses: { |
34 | | - 200: { |
35 | | - description: "Successful execution", |
36 | | - content: { |
37 | | - "application/json": { |
38 | | - schema: resolver(executeResponseSchema), |
39 | | - }, |
40 | | - }, |
41 | | - }, |
42 | | - }, |
43 | | - }), |
44 | | - zValidator("json", executeRequestSchema), |
45 | | - createExecuteHandler("javascript"), |
46 | | -); |
47 | | - |
48 | | -app.post( |
49 | | - "/typescript", |
50 | | - describeRoute({ |
51 | | - operationId: "executeTypeScript", |
52 | | - description: "Execute TypeScript code", |
53 | | - responses: { |
54 | | - 200: { |
55 | | - description: "Successful execution", |
56 | | - content: { |
57 | | - "application/json": { |
58 | | - schema: resolver(executeResponseSchema), |
59 | | - }, |
60 | | - }, |
61 | | - }, |
62 | | - }, |
63 | | - }), |
64 | | - zValidator("json", executeRequestSchema), |
65 | | - createExecuteHandler("typescript"), |
66 | | -); |
67 | | - |
68 | | -export default app; |
| 8 | +export { app as routes} |
0 commit comments