@@ -330,7 +330,6 @@ const api = new Hono<ApiContext>();
330330// Set up global middleware that runs on every request
331331// - Logger gives us visibility into what is happening
332332app .use (" *" , logger ());
333- app .use (" *" , requireAuth );
334333
335334// Wire up all our authentication routes (login, etc)
336335// These will be mounted under /api/v1/auth/
@@ -418,6 +417,8 @@ Now we need to export the Durable Object in our main `src/index.ts` file:
418417``` typescript title="src/index.ts"
419418import { Interview } from " ./interview" ;
420419
420+ // ... previous code ...
421+
421422export { Interview };
422423
423424export default app ;
@@ -846,6 +847,7 @@ import {
846847 InterviewTitle ,
847848 InterviewSkill ,
848849} from " ../types" ;
850+ import { requireAuth } from " ../middleware/auth" ;
849851
850852/**
851853 * Gets the Interview Durable Object instance for a given user.
@@ -914,6 +916,7 @@ const createInterview = async (ctx: HonoCtx) => {
914916 */
915917export const configureInterviewRoutes = () => {
916918 const router = new Hono <ApiContext >();
919+ router .use (" *" , requireAuth );
917920 router .get (" /" , getAllInterviews );
918921 router .post (" /" , createInterview );
919922 return router ;
@@ -935,7 +938,7 @@ import type { ApiContext } from "./types";
935938const app = new Hono <ApiContext >();
936939const api = new Hono <ApiContext >();
937940
938- app .use (" " , logger ());
941+ app .use (" * " , logger ());
939942
940943api .route (" /auth" , configureAuthRoutes ());
941944api .route (" /interviews" , configureInterviewRoutes ());
0 commit comments