| 15 |
15 |
|
export const honoRpcTemplate = `import { Hono } from "hono"; |
| 16 |
16 |
|
import { cors } from "hono/cors"; |
| 17 |
17 |
|
import type { ApiResponse } from "shared/dist"; |
| 18 |
|
- |
import { hc } from "hono/client"; |
| 19 |
18 |
|
|
| 20 |
19 |
|
export const app = new Hono() |
| 21 |
20 |
|
|
|
| 34 |
33 |
|
return c.json(data, { status: 200 }); |
| 35 |
34 |
|
}); |
| 36 |
35 |
|
|
| 37 |
|
- |
const client = hc<typeof app>(""); |
| 38 |
|
- |
export type Client = typeof client; |
|
36 |
+ |
export default app;`; |
| 39 |
37 |
|
|
| 40 |
|
- |
export const hcWithType = (...args: Parameters<typeof hc>): Client => |
| 41 |
|
- |
hc<typeof app>(...args); |
|
38 |
+ |
export const honoClientTemplate = `import { hc } from "hono/client"; |
|
39 |
+ |
import type { app } from "./index"; |
| 42 |
40 |
|
|
| 43 |
|
- |
export default app;`; |
|
41 |
+ |
export type AppType = typeof app; |
|
42 |
+ |
export type Client = ReturnType<typeof hc<AppType>>; |
|
43 |
+ |
|
|
44 |
+ |
export const hcWithType = (...args: Parameters<typeof hc>): Client => |
|
45 |
+ |
hc<AppType>(...args);`; |
| 44 |
46 |
|
|
| 45 |
47 |
|
export const tailwindTemplate = `import { useState } from 'react' |
| 46 |
48 |
|
import beaver from './assets/beaver.svg' |
| 47 |
|
- |
import { hcWithType } from 'server' |
|
49 |
+ |
import { hcWithType } from 'server/dist/client' |
| 48 |
50 |
|
|
| 49 |
51 |
|
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000" |
| 50 |
52 |
|
|
|
| 109 |
111 |
|
export const shadcnTemplate = `import { useState } from 'react' |
| 110 |
112 |
|
import beaver from './assets/beaver.svg' |
| 111 |
113 |
|
import { Button } from './components/ui/button' |
| 112 |
|
- |
import { hcWithType } from 'server' |
|
114 |
+ |
import { hcWithType } from 'server/dist/client' |
| 113 |
115 |
|
|
| 114 |
116 |
|
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000" |
| 115 |
117 |
|
|
|
| 177 |
179 |
|
|
| 178 |
180 |
|
export const defaultTemplate = `import { useState } from 'react' |
| 179 |
181 |
|
import beaver from './assets/beaver.svg' |
| 180 |
|
- |
import { hcWithType } from 'server' |
|
182 |
+ |
import { hcWithType } from 'server/dist/client' |
| 181 |
183 |
|
import './App.css' |
| 182 |
184 |
|
|
| 183 |
185 |
|
const SERVER_URL = import.meta.env.VITE_SERVER_URL || "http://localhost:3000" |