Skip to content

Commit

Permalink
move to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwit-y committed Nov 5, 2024
1 parent 8eb7495 commit 34ba1e0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
Empty file removed database.types.ts
Empty file.
18 changes: 9 additions & 9 deletions libs/mod/vocabulary/routes.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Hono } from "hono";
import { container, Instances } from "../../config/container.ts";
import type { IVocabularyService } from "./service.ts";
import authMiddleware from "../../middleware/auth.middleware.ts";
import { container, Instances } from "../../utils/config/container.ts";
import authMiddleware from "../../utils/middleware/auth.middleware.ts";

const vocabularyRoutes = new Hono()
.use("*", authMiddleware)
.post("/create", async (c) => {
const body = await c.req.json<{ word: string }>();
const srv = container.get<IVocabularyService>(Instances.VocabularyService);
const res = await srv.insert(body.word);
return c.json(res);
});
.use("*", authMiddleware)
.post("/create", async (c) => {
const body = await c.req.json<{ word: string }>();
const srv = container.get<IVocabularyService>(Instances.VocabularyService);
const res = await srv.insert(body.word);
return c.json(res);
});

export default vocabularyRoutes;
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IUserService } from "./../mod/auth/service.ts";
import { MiddlewareHandler } from "hono";
import { getCookie } from "hono/cookie";
import { container, Instances } from "../config/container.ts";
import type { IUserService } from "../../mod/auth/service.ts";

const authMiddleware: MiddlewareHandler = async (c, next) => {
const accessToken = getCookie(c, "access_token");
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Hono } from "hono";
// import { bearerAuth } from "hono/bearer-auth";
import { container, Instances } from "./libs/config/container.ts";
import type { IVocabularyService } from "./libs/mod/vocabulary/service.ts";
// import { container, Instances } from "./libs/config/container.ts";
// import type { IVocabularyService } from "./libs/mod/vocabulary/service.ts";
import authRoutes from "./libs/mod/auth/routes.ts";
import vocabularyRoutes from "./libs/mod/vocabulary/routes.ts";
import authMiddleware from "./libs/middleware/auth.middleware.ts";
// import authMiddleware from "./libs/middleware/auth.middleware.ts";

// const readToken = "read";
// const prvilegedToekn = "read+write";
const privilegedMethods = ["POST", "PUT", "PATCH", "DELETE"];
// const privilegedMethods = ["POST", "PUT", "PATCH", "DELETE"];

const app = new Hono();

Expand Down

1 comment on commit 34ba1e0

@deno-deploy
Copy link
Contributor

@deno-deploy deno-deploy bot commented on 34ba1e0 Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

Module not found "file:///src/libs/db/index.ts".

Please sign in to comment.