Skip to content

Commit b3935c1

Browse files
committed
feat(main): implementation of router to point towards correct controller
1 parent 70549a4 commit b3935c1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { Context, Hono } from "hono";
22
import { jwk } from "hono/jwk";
33
import { cors } from "hono/cors";
44
import { userinfo } from "./middleware/userinfo.ts";
5+
import auth from "./controllers/auth/auth.ts";
56

7+
// Main Application Router
68
const app = new Hono();
79

10+
// CORS Middleware
811
app.use(
912
cors({
1013
origin: Deno.env.get("CORS_ORIGIN_WHITELIST")!.split(","),
@@ -15,16 +18,21 @@ app.use(
1518
}),
1619
);
1720

21+
// JWKS Middleware for Authentication
1822
app.use(
1923
jwk({
2024
jwks_uri: Deno.env.get("AUTHENTICATION_JWKS")!,
2125
}),
2226
);
2327

28+
// Userinfo Middleware for fetching User Info from Keycloak
2429
app.use(userinfo);
2530

2631
app.get("/", (c: Context) => {
27-
return c.json(JSON.parse(c.get("userinfo")));
32+
return c.json(JSON.parse(c.get("authenticationinfo")));
2833
});
2934

35+
// ------------- Controllers for Different Modules ------------- #
36+
app.route("/", auth);
37+
3038
Deno.serve({ port: 9080 }, app.fetch);

0 commit comments

Comments
 (0)