You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
765 B
33 lines
765 B
import AdminJSFastify from '@adminjs/fastify';
|
|
import MongooseAdapter from '@adminjs/mongoose';
|
|
import AdminJS from 'adminjs';
|
|
import { createUserResource } from './resources/user/user.resource';
|
|
import { FastifyInstance } from 'fastify';
|
|
|
|
const setupAdmin = async (app: FastifyInstance): Promise<AdminJS> => {
|
|
AdminJS.registerAdapter(MongooseAdapter);
|
|
|
|
const admin = new AdminJS({
|
|
rootPath: '/admin',
|
|
resources: [],
|
|
});
|
|
|
|
await AdminJSFastify.buildRouter(
|
|
admin,
|
|
// {
|
|
// cookiePassword: 'secretsecretsecretsecretsecretsecretsecretsecret',
|
|
// authenticate: () => {
|
|
// return {
|
|
// id: 1,
|
|
// email: 'Admin',
|
|
// };
|
|
// },
|
|
// },
|
|
app
|
|
);
|
|
|
|
return admin
|
|
};
|
|
|
|
export default setupAdmin;
|