26 lines
1.0 KiB
Markdown
26 lines
1.0 KiB
Markdown
|
|
# 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": "..." }`
|