DGCP3
DGCP3
Explore posts from servers
TTCTheo's Typesafe Cult
Created by DGCP3 on 9/26/2024 in #questions
How to add swagger to hono api
I want to add a swagger doc to my API and when I add middleware to any new OpenAPIHono instance the ".openapi" method disappears.
/**
* Creates a base instance of Hono with middleware.
* @returns {Hono} The base instance of Hono.
*/
const base = () => new OpenAPIHono().use(databaseMiddleware).use(bucketMiddleware).use(cacheMiddleware);

/**
* Represents a public route.
* @returns {Hono}
*/
export const publicHonoRoute = () => base(); // public route

/**
* Marks a route as protected.
* @returns {Hono}
*/
export const protectedHonoRoute = () => base().use(protect).use(typesenseMiddleware); // protected route
/**
* Creates a base instance of Hono with middleware.
* @returns {Hono} The base instance of Hono.
*/
const base = () => new OpenAPIHono().use(databaseMiddleware).use(bucketMiddleware).use(cacheMiddleware);

/**
* Represents a public route.
* @returns {Hono}
*/
export const publicHonoRoute = () => base(); // public route

/**
* Marks a route as protected.
* @returns {Hono}
*/
export const protectedHonoRoute = () => base().use(protect).use(typesenseMiddleware); // protected route
this is my factory method. the instance returned doesn't have ".openapi' on it so I can pass my schema returned by createRoute().
20 replies
HHono
Created by DGCP3 on 9/26/2024 in #help
Adding swagger to hono API
I want to add a swagger doc to my API and when I add middleware to any new OpenAPIHono instance the .openapi method disappears.
/**
* Creates a base instance of Hono with middleware.
* @returns {Hono} The base instance of Hono.
*/
const base = () => new OpenAPIHono().use(databaseMiddleware).use(bucketMiddleware).use(cacheMiddleware);

/**
* Represents a public route.
* @returns {Hono}
*/
export const publicHonoRoute = () => base(); // public route

/**
* Marks a route as protected.
* @returns {Hono}
*/
export const protectedHonoRoute = () => base().use(protect).use(typesenseMiddleware); // protected route
/**
* Creates a base instance of Hono with middleware.
* @returns {Hono} The base instance of Hono.
*/
const base = () => new OpenAPIHono().use(databaseMiddleware).use(bucketMiddleware).use(cacheMiddleware);

/**
* Represents a public route.
* @returns {Hono}
*/
export const publicHonoRoute = () => base(); // public route

/**
* Marks a route as protected.
* @returns {Hono}
*/
export const protectedHonoRoute = () => base().use(protect).use(typesenseMiddleware); // protected route
this is my factory method. the instance returned doesn't have .openapi, so I can pass my schema returned by createRoute().
4 replies
PPrisma
Created by DGCP3 on 7/26/2024 in #help-and-questions
Prisma optimize showing error page
No description
14 replies
TTCTheo's Typesafe Cult
Created by DGCP3 on 7/24/2024 in #questions
how to make c.get("jwtPayload") type safe in hono
how to add type to jwt payload in hono js
20 replies
TTCTheo's Typesafe Cult
Created by DGCP3 on 2/8/2024 in #questions
i need help on type
No description
35 replies