Open yogevlahyani opened 4 years ago
I'm not sure I understand your issue. Using setGlobalPrefix
does also set the prefix on the admin route.
For example, setting app.setGlobalPrefix('api')
makes the admin login page be available at /api/admin/login
Are you encountering a problem with this behaviour?
setGlobalPrefix does not apply the admin endpoint..
But my question is whether you can define a different prefix for the admin module, for example if my global prefix is /v1
, can the admin module prefix be /management
and not /v1/management
?
I can't seem to reproduce the global prefix not being applied. Do you have an example showing that?
There's no easy way to change the prefix no, I'm not aware of a way to ignore the global prefix in NestJS.
Something that could be done would be to create your own admin module (https://nestjs-admin.com/docs/custom-admin-module) independent from the rest of your app, where you'd have all the adminSite.register
, then do something like this to start 2 applications: one for the admin and one for you actual application. But it means that you need to listen on 2 ports, and some reverse proxy to forward requests to the correct app depending on the prefix. I wouldn't do that unless I don't have a choice
I think the problem here isnt the prefix, you can hit the route, but when you send an XHR, it should check if app has global prefix and attach it to the request url
Current behavior is that it tries the req, it cuts your prefix from the route since it didnt hit it and then you end up on a not found page
Current behavior is that it tries the req, it cuts your prefix from the route since it didnt hit it and then you end up on a not found page
Have the same issue. I'm using 'api' global prefix for my app
, and can open login page at .../api/admin/login, but when click button to login, got "Not Found" error because request with my login info sended to ../admin/login indtead of .../api/admin/login. Do you found any solution?
Just do not use the global prefix. You have to manually add it on your @Controller decorators
On Fri, Jun 5, 2020, 10:02 maksimoancha notifications@github.com wrote:
Current behavior is that it tries the req, it cuts your prefix from the route since it didnt hit it and then you end up on a not found page
Have the same issue. I'm using 'api' global prefix for my app, and can open login page at .../api/admin/login, but when click button to login, got "Not Found" error because request with my login info sended to ../admin/login indtead of .../api/admin/login. Do you found any solution?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Theodo-UK/nestjs-admin/issues/159#issuecomment-639324269, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACX65JVGAISY2GDC3SIZSHTRVCRCNANCNFSM4LRFCUCA .
Is it possible to configure app prefix or use it out-of-the-box when setting up
app.setGlobalPrefix
?