add
This commit is contained in:
parent
54c8fa6bf2
commit
2ea9522940
|
@ -1,50 +1,50 @@
|
|||
import { Hono } from 'hono'
|
||||
import { logger } from 'hono/logger'
|
||||
import { contextStorage, getContext } from 'hono/context-storage'
|
||||
import { prettyJSON } from 'hono/pretty-json'
|
||||
import { Hono } from 'hono';
|
||||
import { logger } from 'hono/logger';
|
||||
import { contextStorage, getContext } from 'hono/context-storage';
|
||||
import { prettyJSON } from 'hono/pretty-json';
|
||||
|
||||
import { trpcServer } from '@hono/trpc-server'
|
||||
import { appRouter } from './trpc'
|
||||
import Redis from 'ioredis'
|
||||
import redis from './redis'
|
||||
import minioClient from './minio'
|
||||
import { Client } from 'minio'
|
||||
import oidc from './oidc/provider'
|
||||
import { trpcServer } from '@hono/trpc-server';
|
||||
import { appRouter } from './router';
|
||||
import Redis from 'ioredis';
|
||||
import redis from './redis';
|
||||
import minioClient from './minio';
|
||||
import { Client } from 'minio';
|
||||
import oidc from './oidc/provider';
|
||||
type Env = {
|
||||
Variables: {
|
||||
redis: Redis
|
||||
minio: Client
|
||||
}
|
||||
}
|
||||
redis: Redis;
|
||||
minio: Client;
|
||||
};
|
||||
};
|
||||
|
||||
const app = new Hono<Env>()
|
||||
const app = new Hono<Env>();
|
||||
|
||||
app.use('*', async (c, next) => {
|
||||
c.set('redis', redis)
|
||||
c.set('minio', minioClient)
|
||||
await next()
|
||||
})
|
||||
c.set('redis', redis);
|
||||
c.set('minio', minioClient);
|
||||
await next();
|
||||
});
|
||||
app.use('*', async (c, next) => {
|
||||
c.set('redis', redis);
|
||||
await next();
|
||||
});
|
||||
app.use(contextStorage())
|
||||
app.use(prettyJSON()) // With options: prettyJSON({ space: 4 })
|
||||
app.use(logger())
|
||||
app.use(contextStorage());
|
||||
app.use(prettyJSON()); // With options: prettyJSON({ space: 4 })
|
||||
app.use(logger());
|
||||
app.use(
|
||||
'/trpc/*',
|
||||
trpcServer({
|
||||
router: appRouter,
|
||||
})
|
||||
)
|
||||
}),
|
||||
);
|
||||
|
||||
app.get('/', (c) => {
|
||||
return c.text('Hello Hono!')
|
||||
})
|
||||
return c.text('Hello Hono!');
|
||||
});
|
||||
app.use('/oidc/*', async (c, next) => {
|
||||
// @ts-ignore
|
||||
await oidc.callback(c.req.raw, c.res.raw)
|
||||
await oidc.callback(c.req.raw, c.res.raw);
|
||||
// return void 也可以
|
||||
return
|
||||
})
|
||||
export default app
|
||||
return;
|
||||
});
|
||||
export default app;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import { router } from './trpc';
|
||||
import { userRouter } from './user/user.trpc';
|
||||
|
||||
export const appRouter = router({
|
||||
user: userRouter,
|
||||
});
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
|
@ -1,14 +1,6 @@
|
|||
import { z } from 'zod'
|
||||
import { initTRPC } from '@trpc/server'
|
||||
import { userRouter } from './user/user.trpc'
|
||||
import { initTRPC } from '@trpc/server';
|
||||
|
||||
const t = initTRPC.create()
|
||||
const t = initTRPC.create();
|
||||
|
||||
export const publicProcedure = t.procedure
|
||||
export const router = t.router
|
||||
|
||||
export const appRouter = router({
|
||||
user: userRouter
|
||||
})
|
||||
|
||||
export type AppRouter = typeof appRouter
|
||||
export const publicProcedure = t.procedure;
|
||||
export const router = t.router;
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
"moduleResolution": "bundler",
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
"@repo/db/*": ["../../packages/db/src/*"],
|
||||
},
|
||||
|
||||
"@repo/db/*": ["../../packages/db/src/*"]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import { useTRPC } from '@repo/client';
|
||||
|
||||
// import { api } from '@repo/client';
|
||||
// import { Button } from '@repo/ui/components/button';
|
||||
// import { useState } from 'react';
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
import * as React from 'react';
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
||||
import QueryProvider from '@/providers/query-provider';
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<QueryProvider>
|
||||
<NextThemesProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
|
@ -14,5 +16,6 @@ export function Providers({ children }: { children: React.ReactNode }) {
|
|||
>
|
||||
{children}
|
||||
</NextThemesProvider>
|
||||
</QueryProvider>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
services:
|
||||
minio:
|
||||
image: minio/minio:${MINIO_VERSION:-RELEASE.2024-04-22T22-12-26Z}
|
||||
image: minio/minio:${MINIO_VERSION:-RELEASE.2024-04-18T19-09-19Z}
|
||||
container_name: minio
|
||||
restart: always
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9001:9001"
|
||||
- '9000:9000'
|
||||
- '9001:9001'
|
||||
networks:
|
||||
- nice-net
|
||||
environment:
|
||||
|
@ -17,7 +17,7 @@ services:
|
|||
target: /data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { api } from '../trpc';
|
||||
|
||||
export function useHello() {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue