This microservice is designed to handle functionalities used by candidates, such as uploading there personal info and CV.
- Post Candidate Info: Candidates can upload there informataion.
- Post Candidate CV: Candidates can upload there CV using s3 signed url.
- Preview Candidate CV: Candidates can preview there current uploaded CV.
- Language/Framework: [ Typescript, Node.js with Express]
- Database: [ MongoDB ]
- Authentication: [ JWT ]
- Cloud Services: [ AWS SQS, AWS S3 ]
- Containerization: [ Docker ]
- Install node v18.19.0
-
Clone the repository:
git clone https://github.com/ShashwotBhattarai/candidate_microservice.git
-
Install NPM packages:
npm install
-
Add env variables:
DATABASEURI= JWTSECRET= AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_REGION= S3_DEFAULT_BUCKET_NAME= S3_BAD_BUCKET_NAME= SQS_QUEUE_URL= ENV= PORT= ACCESS_CONTROL_ALLOW_ORIGIN_URL=http://localhost:{{PORT}}
-
Run the application:
npm run start
-
To test apis:
Health check API: curl --location 'http://localhost:{{CANDIDATE_MS_PORT}}/candidate/health' GetOne Candidate Info API: curl --location 'http://localhost:{{PORT}}/candidate/candidateInfo/getCandidateInfo/{{user_id}}' \ --header 'Authorization: Bearer {{<Token>}}' Get default bucket upload url API: curl --location 'http://localhost:{{PORT}}/candidate/s3/getDefaultUploadUrl' \ --header 's3filekey: {{<S3filekey>}}' \ --header 'Authorization: Bearer {{<Token>}}' Get bad bucket upload url API: curl --location 'http://localhost:{{PORT}}/candidate/s3/getBadbucketUploadURL' \ --header 's3filekey: {{<S3filekey>}}' \ --header 'Authorization: Bearer {{<Token>}}' Save Candidate info API: curl --location 'http://localhost:{{PORT}}/candidate/candidateInfo/saveCandidateInfo' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {{<Token>}}' \ --data-raw '{ "fullname": {{Fullname}}, "email": "{{Email}}", "phone_number": "{{PhoneNumber}}" }' Update s3filekey API: curl --location --request POST 'http://localhost:{{PORT}}/candidate/candidateInfo/updateS3FileKey' \ --header 's3filekey: {{<S3filekey>}}' \ --header 'bucket: {{<bucketname(default/bad)>}}' \ --header 'Authorization: Bearer {{<Token>}}'
npm run test
Please refer the following link to setup SonarQube in your machine.
After a project has been setup you will get a command that looks like below, which one much execute in the root dir of that respective project to run the analysis.
sonar-scanner \
-Dsonar.projectKey={{<PROJECTKEY>}} \
-Dsonar.sources=. \
-Dsonar.host.url={{<URL_WHERE_SONARQUBE_IS_HOSTED>}} \
-Dsonar.token={{<TOKEN FOR THE PROJECT>}}