-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-adminjs.mjs
More file actions
29 lines (25 loc) · 810 Bytes
/
Copy pathtest-adminjs.mjs
File metadata and controls
29 lines (25 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import mongoose from 'mongoose';
import AdminJS from 'adminjs';
import AdminJSExpress from '@adminjs/express';
import * as AdminJSMongoose from '@adminjs/mongoose';
// Load models to register them with mongoose
import './models/clitool.model.js';
import './models/category.model.js';
import './models/user.model.js';
AdminJS.registerAdapter(AdminJSMongoose);
const adminJs = new AdminJS({
rootPath: '/admin',
resources: [
mongoose.model('CliTool'),
mongoose.model('Category'),
mongoose.model('User'),
],
branding: { companyName: 'Test', withMadeWithLove: false },
});
try {
await adminJs.initialize();
console.log('AdminJS initialized OK with all resources');
} catch (e) {
console.error('INIT ERROR:', e.message);
console.error(e.stack?.split('\n').slice(0, 10).join('\n'));
}