Description:
Before you get started, navigate to the server folder and check the Swagger documentation. There, you'll get an overview of how the API should behave.
cd server
npm run start
// open your browser and type http://localhost:3000/api-docs
All backend work should be done inside the server folder. Please be cautious about entering backend-related commands outside of the server folder, as the server folder is an independent module and contains its own package.json file.
If you're not familiar with HTTP Method, check:
https://velog.io/@yh20studio/CS-Http-Method-%EB%9E%80-GET-POST-PUT-DELETE
Resume API receives a request with a PDF file payload from the user's frontend and returns the processing result from the Naive Bayes classifiers. The returned information contains the top N most matching resume sub-categories (e.g., software developer, business analyst, QA engineer, etc.) and a numeric value indicating the strength of the match.
Example response payload would be something as follows,
{
category_matches: {
1: {
"category_id": 1234,
"category_name": "software engineer",
"weight_sum": 87
},
2: {
"category_id": 2222,
"category_name": "business analyst",
"weight_sum": 35
}
}
}
Likely Resume API is consisting of the following endpoints,
POST /resume - send a resume file to the server and requests for evaluation
However, we do not currently have a Python preprocessor that handles PDF files yet. The goal of this ticket is to implement only the communication between React and Express.js. The React frontend should make an API call to the Resume API with a PDF file attached. Express.js receives the request and the PDF file but sends back only a sample result.
This means, you can simply define the resume API request and response and follows,
POST /resume
request
user_id: "sample_user_id",
resume: [PDF FILE]
response
message: "ok",
status: 200,
category_matches: {
1: {
"category_id": 1234,
"category_name": "software engineer",
"weight_sum": 87
},
2: {
"category_id": 2222,
"category_name": "business analyst",
"weight_sum": 35
}
}
Please note that the implementation of the API is entirely up to you, but it is recommended to include message and status code field in your API response:
200
message: "ok",
status: 200
400
message: "[ERROR MESSAGE",
status: 400
To know more about the HTTP status code, please check the following:
https://sanghaklee.tistory.com/61
What you will be implementing is:
- Resume API request and response format.
Tutorials:
https://velog.io/@ongsim123/node.js-express-server
https://expressjs.com/ko/starter/hello-world.html
You can conveniently test your API with Postman during the development.
Postman: https://dev-cini.tistory.com/7
Postman & Express JS: https://roughroad.tistory.com/153
Sign Up API example: https://github.com/sfuSwSo/swe-resume-evaluator/blob/main/server/src/routers/auth/index.js
-
Make Express.js and the Resume API capable of receiving a PDF file from the frontend.
Please refer to the following tutorial.
https://velog.io/@nahye/multer%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%98%EC%97%AC-React-Node.js-%ED%8C%8C%EC%9D%BC-%EC%97%85%EB%A1%9C%EB%93%9C-%EA%B5%AC%ED%98%84%ED%95%98%EA%B8%B0
If it involves creating a directory for saving uploaded PDF files, please make sure to add the directory path to .gitignore so that it won't be pushed to the remote repository.
-
Documentation using Swagger
Tutorial:
https://joooohee.tistory.com/10
Check the example swagger documentation:
https://github.com/sfuSwSo/swe-resume-evaluator/blob/main/server/src/routers/auth/index.js
Other Swagger macros and fields:
https://swagger.io/docs/specification/describing-parameters/
-
Unit test using supertest
Tutorial:
https://inpa.tistory.com/entry/JEST-%F0%9F%93%9A-supertest-api-%EC%9A%94%EC%B2%AD%ED%85%8C%EC%8A%A4%ED%8A%B8
Example:
https://github.com/sfuSwSo/swe-resume-evaluator/blob/main/server/src/__tests__/auth/auth.test.js
Acceptance Criteria:
- Resume API request and response. While the API sends back a sample response, it should be capable of handling a resume file transferred from the frontend.
- Swagger documentation. The new api should appear at localhost:3000/api-docs
- Unit testing. No mocking is likely required for this ticket.