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(() => {
@@ -235,6 +235,11 @@ async function writeTemplateFiles(dirname, cwd, options) {
235
235
  dest: 'index.ts',
236
236
  data: { appName },
237
237
  },
238
+ {
239
+ src: 'api.ts.hbs',
240
+ dest: 'api.ts',
241
+ data: {},
242
+ },
238
243
  {
239
244
  src: '.gitignore.hbs',
240
245
  dest: '.gitignore',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.4.0-next.240",
3
+ "version": "2.4.0-next.242",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",