Joker
Joker
Explore posts from servers
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
yeah worked
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
yeah i think i will do that and then make an if check
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
sure
const routes = app
.route('/', authApp)
.route('/', secretApp);

export type AppType = typeof routes;

export { app };

// OTHER FILE:
import { secret } from '@/server/routes/secret/secret';
import type { ContextVariables } from '@/server/types';
import { OpenAPIHono } from '@hono/zod-openapi';

export const secretApp = new OpenAPIHono<{ Variables: ContextVariables }>()
.use(async (c, next) => {
const user = c.get('user');
if (!user) {
c.status(401);
return c.body(null);
}

return next();
})
.route('/', secret);

// OTHER FILE:

import type { ContextVariables } from '@/server/types';
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';

export const secret = new OpenAPIHono<{ Variables: ContextVariables }>().openapi(
createRoute({
method: 'get',
path: '/api/secret',
tags: ['Secret'],
summary: 'Shhh...',
responses: {
200: {
description: 'Success',
content: {
'application/json': {
schema: z
.object({
message: z.string(),
email: z.string().email(),
})
.openapi('SecretResponse'),
},
},
},
},
}),
async c => {
const user = c.get('user')!;

return c.json({
message: 'Secret Message',
email: user.email,
});
}
);
const routes = app
.route('/', authApp)
.route('/', secretApp);

export type AppType = typeof routes;

export { app };

// OTHER FILE:
import { secret } from '@/server/routes/secret/secret';
import type { ContextVariables } from '@/server/types';
import { OpenAPIHono } from '@hono/zod-openapi';

export const secretApp = new OpenAPIHono<{ Variables: ContextVariables }>()
.use(async (c, next) => {
const user = c.get('user');
if (!user) {
c.status(401);
return c.body(null);
}

return next();
})
.route('/', secret);

// OTHER FILE:

import type { ContextVariables } from '@/server/types';
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';

export const secret = new OpenAPIHono<{ Variables: ContextVariables }>().openapi(
createRoute({
method: 'get',
path: '/api/secret',
tags: ['Secret'],
summary: 'Shhh...',
responses: {
200: {
description: 'Success',
content: {
'application/json': {
schema: z
.object({
message: z.string(),
email: z.string().email(),
})
.openapi('SecretResponse'),
},
},
},
},
}),
async c => {
const user = c.get('user')!;

return c.json({
message: 'Secret Message',
email: user.email,
});
}
);
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
property 'secret' does not exist on type '{ auth: { register: { "send-registration-code": ClientRequest<{ $post: { input: { json: { email: string; agree: boolean; }; }; output: {}; outputFormat: string; status: 200; }; }>; }; }; } & { ...; } & { ...; } & { ...; }'.ts(2339)roperty 'secret' does not exist on type '{ auth: { register: { "send-registration-code": ClientRequest<{ $post: { input: { json: { email: string; agree: boolean; }; }; output: {}; outputFormat: string; status: 200; }; }>; }; }; } & { ...; } & { ...; } & { ...; }'.ts(2339)
property 'secret' does not exist on type '{ auth: { register: { "send-registration-code": ClientRequest<{ $post: { input: { json: { email: string; agree: boolean; }; }; output: {}; outputFormat: string; status: 200; }; }>; }; }; } & { ...; } & { ...; } & { ...; }'.ts(2339)roperty 'secret' does not exist on type '{ auth: { register: { "send-registration-code": ClientRequest<{ $post: { input: { json: { email: string; agree: boolean; }; }; output: {}; outputFormat: string; status: 200; }; }>; }; }; } & { ...; } & { ...; } & { ...; }'.ts(2339)
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
No description
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
yes
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
it's from @hono/zod-openapi
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
it's only for the intelisense/types, the request works
31 replies
HHono
Created by Joker on 1/15/2025 in #help
Hono RPC issue with .use
When I remove the .use it works without any problems
31 replies
KKord
Created by Joker on 1/2/2025 in #help
Error after adding kord dependency
yeah you are right
7 replies
KKord
Created by Joker on 1/2/2025 in #help
Error after adding kord dependency
I already have the ktor client dependency installed for other api fetches, but the error only occurs on startup when kord is installed
7 replies
HHono
Created by Joker on 7/14/2024 in #help
Cookies not available in other Route
ty very much
18 replies
HHono
Created by Joker on 7/14/2024 in #help
Cookies not available in other Route
&state is the solution
18 replies
HHono
Created by Joker on 7/14/2024 in #help
Cookies not available in other Route
&redirect_uri=${redirectUri} + &state=${c.req.param("userId")}; I need to do this
18 replies
HHono
Created by Joker on 7/14/2024 in #help
Cookies not available in other Route
I found something
18 replies
HHono
Created by Joker on 7/14/2024 in #help
Cookies not available in other Route
oh whait
18 replies
HHono
Created by Joker on 7/14/2024 in #help
Cookies not available in other Route
everytime it says invalid redirect uri
18 replies
HHono
Created by Joker on 7/14/2024 in #help
Cookies not available in other Route
sadly spotify doesnt allow to pass state
18 replies