adminforth 2.4.0-next.240 → 2.4.0-next.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Express } from "express";
|
|
2
|
+
import { IAdminForth } from "adminforth";
|
|
3
|
+
|
|
4
|
+
export function initApi(app: Express, admin: IAdminForth) {
|
|
5
|
+
app.get(`${admin.config.baseUrl}/api/hello/`,
|
|
6
|
+
(req, res) => {
|
|
7
|
+
res.json({ message: "Hello from AdminForth API!" });
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -4,7 +4,8 @@ import usersResource from "./resources/adminuser.js";
|
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { Filters } from 'adminforth';
|
|
7
|
-
|
|
7
|
+
import { initApi } from './api.js';
|
|
8
|
+
|
|
8
9
|
const ADMIN_BASE_URL = '';
|
|
9
10
|
|
|
10
11
|
export const admin = new AdminForth({
|
|
@@ -69,6 +70,8 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
|
|
|
69
70
|
const app = express();
|
|
70
71
|
app.use(express.json());
|
|
71
72
|
|
|
73
|
+
initApi(app, admin);
|
|
74
|
+
|
|
72
75
|
const port = 3500;
|
|
73
76
|
|
|
74
77
|
admin.bundleNow({ hotReload: process.env.NODE_ENV === 'development' }).then(() => {
|