Files
kulakpos_web/walkthroughs/2026-04-15_a959f93c_Walkthrough__Expose_Bawahan_Advance_API.md

26 lines
1.0 KiB
Markdown
Raw Normal View History

2026-05-14 11:55:22 +07:00
# Walkthrough - Expose Bawahan Advance API
I have successfully exposed the `getdatadetailsbawahan` function as an API endpoint.
## Changes Made
### [Bawahan Advance Component]
#### [NEW] [bawahan-advance-routes.js](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS PROJECT/ess_api/ess_api/app/routes/bawahan-advance-routes.js)
Created a new route file that defines the `POST /api/bawahan/getdatadetailsbawahan` endpoint. This endpoint is protected by the `jwtAuth.verifyToken` middleware.
#### [MODIFY] [server.js](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS PROJECT/ess_api/ess_api/server.js)
Registered the new route file in the main `server.js` file so it's loaded when the server starts.
## Verification Results
### Code Integrity
- The new route file correctly imports `jwtAuth` and the service `trx-bawahan-advance`.
- `server.js` was updated to include the new routes.
### Endpoint Details
- **Method**: `POST`
- **URL**: `/api/bawahan/getdatadetailsbawahan`
- **Headers**: `Authorization: Bearer <token>`
- **Body**: `{ "nik": "..." }`