forked from dialectlabs/actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
46 lines (39 loc) · 941 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// index.ts
import { serve } from '@hono/node-server';
import donate from './donate/route';
import jitoDonate from './JitoDonate/route';
import jupiterSwap from './jupiter-swap/route';
import { cors } from 'hono/cors';
import { swaggerUI } from '@hono/swagger-ui';
import { OpenAPIHono } from '@hono/zod-openapi';
const app = new OpenAPIHono();
app.use('/*', cors());
// <--Actions-->
app.route('/api/donate', donate);
app.route('/api/jitodonate', jitoDonate);
app.route('/api/jupiter/swap', jupiterSwap);
// </--Actions-->
app.doc('/doc', {
info: {
title: 'An API',
version: 'v1',
},
openapi: '3.1.0',
});
app.get(
'/swagger-ui',
swaggerUI({
url: '/doc',
}),
);
const port = 3000;
console.log(
`Server is running on port ${port}
Visit http://localhost:${port}/swagger-ui to explore existing actions
Visit https://actions.dialect.to to unfurl action into a Blink
`,
);
serve({
fetch: app.fetch,
port,
});