simplymichael / express-user-manager

A user management and authentication library for Express apps. Automatically creates and adds relevant (customizable) API endpoints to an Express app.
MIT License
19 stars 5 forks source link

Configuration issue with `apiMountPoint` and `routes` #3

Closed simplymichael closed 2 years ago

simplymichael commented 2 years ago

As reported by user: @Wall0fDeath:

When i try to configure the routes with the same .config function for example : list : "/" -> list : "/list" localhost:8080/api/users -> localhost:8080/api/users/list

Response for "localhost:8080/api/users/list":

Cannot GET /api/users/list

The same goes for apiMountPoint. If i set it in the config function, it doesn't work, but if I set it in the listen function, it works fine. userManager.listen(app); -> userManager.listen(app, apiMountPoint = "/api/users666");

The database and the session parts are working fine.

Is it an error, or am I calling the config function wrongly or at a wrong location in my demo?

Wall0fDeath commented 2 years ago

I downloaded it and retested them. The password and the routes are working, but the apiMountPoint is still not working from the config function for me. But it is good if I set it in the listen function. Can You check it please? :))

userManager.config({ apiMountPoint : "/api/users666", ... }

...:8080/api/users/list

{"data":{"total":1,"length":1,"users": ....

userManager.listen(app); // userManager.listen(app, apiMountPoint = '/api/users666');

The commented version is working.