forked from dialectlabs/actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
52 lines (46 loc) · 1.3 KB
/
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
47
48
49
50
51
52
import { serve } from '@hono/node-server';
import donate from './donate/route';
import jupiterSwap from './jupiter-swap/route';
import heliusStake from './helius/stake/route';
import sanctumTrade from './sanctum/trade/route';
import tensorBuyFloor from './tensor/buy-floor/route';
import tensorBidNft from './tensor/bid-nft/route';
import meteoraSwap from './meteora/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/jupiter/swap', jupiterSwap);
app.route('/api/helius/stake', heliusStake);
app.route('/api/sanctum/trade', sanctumTrade);
app.route('/api/tensor/buy-floor', tensorBuyFloor);
app.route('/api/tensor/bid-nft', tensorBidNft);
app.route('/api/meteora/swap', meteoraSwap);
// </--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,
});