Skip to content

Commit 00f4bbc

Browse files
author
Pavlo Kulyk
committed
feat: extend API to include user list in response
1 parent f48a6ca commit 00f4bbc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import { Express } from "express";
1+
import { Express, Request, Response } from "express";
22
import { IAdminForth } from "adminforth";
33

44
export function initApi(app: Express, admin: IAdminForth) {
55
app.get(`${admin.config.baseUrl}/api/hello/`,
6-
(req, res) => {
7-
res.json({ message: "Hello from AdminForth API!" });
6+
7+
async (req: Request, res: Response) => {
8+
const allUsers = await admin.resource("adminuser").list([]);
9+
10+
res.json({
11+
message: "Hello from AdminForth API!",
12+
users: allUsers,
13+
});
814
}
915
);
1016
}

0 commit comments

Comments
 (0)