App breaks in RPC mode, works normally
Hi, as soon as I export the
AppTypeAppType as mentioned in the docs. I start getting this error. If I do not export the AppTypeAppType and do the normal export default app;export default app;, app works fine here is my index.tsindex.tsimport { Context, Hono } from 'hono'
import { secureHeaders } from 'hono/secure-headers'
import { Bindings } from './bindings';
import authController from './controllers/auth-controller';
import { initDb } from './db';
import { jwt } from 'hono/jwt'
import templateController from './controllers/template-controller';
const app = new Hono();
app.use(secureHeaders());
app.use("*", async (c: Context<Bindings>, next)=>{
const db = initDb(c);
c.set("db", db);
await next();
});
app.use('/api/auth/test', (c: Context<Bindings>, next) => {
const jwtMiddleware = jwt({
secret: c.env.JWT_SECRET,
cookie: "token"
})
return jwtMiddleware(c, next)
});
const router = app.route('/api/auth', authController).route('/api/template', templateController);
export default app;
export type AppType = typeof router;import { Context, Hono } from 'hono'
import { secureHeaders } from 'hono/secure-headers'
import { Bindings } from './bindings';
import authController from './controllers/auth-controller';
import { initDb } from './db';
import { jwt } from 'hono/jwt'
import templateController from './controllers/template-controller';
const app = new Hono();
app.use(secureHeaders());
app.use("*", async (c: Context<Bindings>, next)=>{
const db = initDb(c);
c.set("db", db);
await next();
});
app.use('/api/auth/test', (c: Context<Bindings>, next) => {
const jwtMiddleware = jwt({
secret: c.env.JWT_SECRET,
cookie: "token"
})
return jwtMiddleware(c, next)
});
const router = app.route('/api/auth', authController).route('/api/template', templateController);
export default app;
export type AppType = typeof router;