diff --git a/config/default.json b/config/default.json index 6c427ee..2346631 100644 --- a/config/default.json +++ b/config/default.json @@ -13,7 +13,6 @@ "max_upload": 104857600, "morgan": "combined", "cors": "*", - "prefix_api": "/api/", "ssl": { "enable": false, "cert": "", diff --git a/config/stag.json b/config/stag.json index 3bd86fa..f6ffe57 100644 --- a/config/stag.json +++ b/config/stag.json @@ -8,12 +8,11 @@ "server": { "port": "4001", "host": "0.0.0.0", - "host_swagger": "https://bri-dev.shiblysolution.id/api/u", + "host_swagger": "https://bri-dev.shiblysolution.id:4001", "max_body": "50mb", "max_upload": 104857600, "morgan": "combined", "cors": "*", - "prefix_api": "/", "ssl": { "enable": false, "cert": "/etc/letsencrypt/live/bri-dev.shiblysolution.id/fullchain.pem", diff --git a/src/routes/private.ts b/src/routes/private.ts index f1066c3..8d9bd32 100644 --- a/src/routes/private.ts +++ b/src/routes/private.ts @@ -1,6 +1,4 @@ import express from 'express'; -import config from 'config'; - import { Language } from '../langs/lang'; import { UserController } from '../controllers/user'; import { UserActivityController } from '../controllers/user_activity'; @@ -15,27 +13,25 @@ export class RoutePrivate { JwtHelper.secure(app); - const prefix_api = config.get('server.prefix_api'); + app.get('/api/user/list', UserController.list) + app.post('/api/user/create', UserController.create) + app.put('/api/user/update/:id', UserController.update) + app.put('/api/user/update_profile', UserController.updateProfile) + app.put('/api/user/update_password', UserController.updatePassword) + app.delete('/api/user/delete/:id', UserController.delete) + app.put('/api/user/restore/:id', UserController.restore) - app.get(prefix_api + 'user/list', UserController.list) - app.post(prefix_api + 'user/create', UserController.create) - app.put(prefix_api + 'user/update/:id', UserController.update) - app.put(prefix_api + 'user/update_profile', UserController.updateProfile) - app.put(prefix_api + 'user/update_password', UserController.updatePassword) - app.delete(prefix_api + 'user/delete/:id', UserController.delete) - app.put(prefix_api + 'user/restore/:id', UserController.restore) + app.get('/api/user_role/list', UserRoleController.list) + app.get('/api/user_role/role', UserRoleController.role) + app.post('/api/user_role/create', UserRoleController.create) + app.put('/api/user_role/update/:id', UserRoleController.update) + app.delete('/api/user_role/delete/:id', UserRoleController.delete) + app.put('/api/user_role/restore/:id', UserRoleController.restore) - app.get(prefix_api + 'user_role/list', UserRoleController.list) - app.get(prefix_api + 'user_role/role', UserRoleController.role) - app.post(prefix_api + 'user_role/create', UserRoleController.create) - app.put(prefix_api + 'user_role/update/:id', UserRoleController.update) - app.delete(prefix_api + 'user_role/delete/:id', UserRoleController.delete) - app.put(prefix_api + 'user_role/restore/:id', UserRoleController.restore) + app.get('/api/user_activity', UserActivityController.list) + app.post('/api/user_activity/create', UserActivityController.create) - app.get(prefix_api + 'user_activity', UserActivityController.list) - app.post(prefix_api + 'user_activity/create', UserActivityController.create) - - app.get(prefix_api + 'refresh_token/list', UserRefreshTokenController.list) - app.put(prefix_api + 'refresh_token/force_logout/:refresh_token', UserRefreshTokenController.forceLogout) + app.get('/api/refresh_token/list', UserRefreshTokenController.list) + app.put('/api/refresh_token/force_logout/:refresh_token', UserRefreshTokenController.forceLogout) } } \ No newline at end of file diff --git a/src/routes/public.ts b/src/routes/public.ts index 121f9b9..29f7dd1 100644 --- a/src/routes/public.ts +++ b/src/routes/public.ts @@ -1,18 +1,16 @@ import express from 'express'; -import config from 'config'; import { AuthController } from '../controllers/auth'; +import { UserController } from '../controllers/user'; export class RoutePublic { static setup(app: express.Application) { - const prefix_api = config.get('server.prefix_api'); - - app.post(prefix_api + 'login', AuthController.login) - app.put(prefix_api + 'reset_password/:email', AuthController.resetPassword) - app.put(prefix_api + 'update_password/:token', AuthController.updatePassword) - app.put(prefix_api + 'logout/:refresh_token', AuthController.logout) - app.put(prefix_api + 'renew_token/:refresh_token', AuthController.renewToken) + app.post('/api/login', AuthController.login) + app.put('/api/reset_password/:email', AuthController.resetPassword) + app.put('/api/update_password/:token', AuthController.updatePassword) + app.put('/api/logout/:refresh_token', AuthController.logout) + app.put('/api/renew_token/:refresh_token', AuthController.renewToken) } } \ No newline at end of file