This project intend to access the API to validate phones from BigData website, to collect the responses and storage in a MongoDb.
To run this project, you must have intalled:
- You must have a KEY from BigData website, do a SignUp om the website and create one.
- docker-compose
- docker
- go (1.20 or higher)
-
Access the project folder through a shell.
-
Export your API_BDC_KEY with the command:
export API_BDC_KEY=<YOUR_KEY> -
In one shell, connect with the MongoDb running the following docker-compose command on the project folder root:
make createDBAppORdocker-compose up- Sometimes the DB takes a realtive long time to get up.
-
In another shell, run the app:
go run cmd/phoneEmailVerification/phoneEmailVerification.go -
If everything runs ok, you should see this message on the shell:
> api server running on http://localhost:8080
-
(POST) Search and save a number:
-
Example:
http://localhost:8080/api/phoneNumber/2018675309/countryCode/us/localityLanguage/en
-
-
(PUT) Search an already saved record and update a number:
-
Example:
http://localhost:8080/api/phoneNumber/2018675309/countryCode/us/localityLanguage/en
-
-
(GET) Get specific number already collected on DB:
-
Example:
http://localhost:8080/api/getPhone/2018675309
-
-
(GET) Get all numbers already collected:
-
Example:
http://localhost:8080/api/getAllPhones
-
- Not available =/
-
In one shell, connect with the MongoDb_test and running the following docker-compose-test command on the project folder root:
make createDBTestORdocker-compose -f docker-compose-test.yaml up -
Use the make comands to run the INTEGRATION and/or UNITARY tests
-
run unitary tests
- to run all tests, just run:
make unitCheck - to run a specific test file, example:
make unitCheck testfile=./internal/repository/ - to run a specific test name, example:
make unitCheck testfile=./internal/repository/ testname=TEST_NAME - if you want to run these tests with a race flag, put -race=race, example:
make unitCheck testfile=./internal/repository/ testname=TEST_NAME -race=race
- to run all tests, just run:
-
run integration tests
- to run all tests, just run:
make integrationCheck - to run a specific test file, example:
make integrationCheck testfile=./internal/repository/ - to run a specific test name, example:
make integrationCheck testfile=./internal/repository/ testname=TEST_NAME
- to run all tests, just run:
-