Categorygithub.com/ArtusC/phoneEmailVerification
repository
0.0.0-20240822120642-56f3910b754d
Repository: https://github.com/artusc/phoneemailverification.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Phone and Email verificator

This project intend to access the API to validate phones from BigData website, to collect the responses and storage in a MongoDb.

Prerequisites

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)

To run the project

  1. Access the project folder through a shell.

  2. Export your API_BDC_KEY with the command:

    export API_BDC_KEY=<YOUR_KEY>

  3. In one shell, connect with the MongoDb running the following docker-compose command on the project folder root:

    make createDBApp OR docker-compose up

    • Sometimes the DB takes a realtive long time to get up.
  4. In another shell, run the app:

    go run cmd/phoneEmailVerification/phoneEmailVerification.go

  5. If everything runs ok, you should see this message on the shell:

    > api server running on http://localhost:8080

Available routes

Verify phones:

  • (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

Verify emails:

  • Not available =/

Running the tests

  1. In one shell, connect with the MongoDb_test and running the following docker-compose-test command on the project folder root:

    make createDBTest OR docker-compose -f docker-compose-test.yaml up

  2. 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
    • 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