fix: app.route overload
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Hono } from "hono"
|
||||
import { fetchUserData } from "../controller/actions"
|
||||
const actions = new Hono()
|
||||
|
||||
|
||||
/*
|
||||
actions.post("actions/message/:id", (c) => {
|
||||
//todo: pass service function to send a message to user id
|
||||
})
|
||||
@@ -14,14 +15,22 @@ actions.get("actions/message/all/:userId", (c) => {
|
||||
//todo: pass service function to fetch all messages f a user
|
||||
})
|
||||
|
||||
actions.get("actions/:id", (c) => {
|
||||
//todo: pass service function to fetch user data by id
|
||||
})
|
||||
|
||||
|
||||
actions.get("actions/userChannels/:id", (c) => {
|
||||
//todo: pass service function to fetch all channels the id is part of
|
||||
})
|
||||
*/
|
||||
|
||||
actions.get("actions/:id", async (c) => {
|
||||
const id = c.req.param("id");
|
||||
const userData = await fetchUserData(id);
|
||||
if (userData) {
|
||||
return c.json(userData);
|
||||
} else {
|
||||
return c.json({ error: "User not found" }, 404);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
export default actions
|
||||
Reference in New Issue
Block a user