Data engineer challenge, using Google APIs and NodeJS
Instructions to have everything you need to put this deployment into operation.
- NodeJS installed.
- A web browser (Mozilla, Chrome, Safari, etc).
- Postman (Just if you like to see prettier the API responses).
Once you have cloned or downloaded a .zip of the project in a folder of your like run:
npm install
just to have all the dependence packages necessaries to run the server.
After the install process you have to configure the enviroment variable (below explained), and then just have to run:
npm start
and the server will bound with the default configuration. You will see debugs on the console.
At this point, you will notice that the console ask you for a auth code, you will have to visit the URL placed in it and navigate trought following the instructions to get the code.
Once you have entered the code a json file 'token.json' will be created for store the oAuth2Client token.
This step is only for the first time you run the code.
You'll notice that the console let you know if there are mails found with 'DevOps' in the body/subject, and if they're saved on the DB.
To check the server with the default configuration, acces to 'http://localhost:3000' in your browser, and you will see 'Hello World!' if everything OK.
To retrieve the data stored you have two options:
- 1_ In the browser, put the URL: 'http://localhost:3000/mails/YOURMAIL' .
- 2_ In Postman, make a new GET request to 'http://localhost:3000/mails/YOURMAIL' .
This project has a enviroment config file maded thanks to the config library (npm) that you can found in 'config/dev.json'.
You can modify the values in it, or just make your own configs in another file inside the 'config' folder. Notice you have to change the enviroment before initializate it:
- $env:NODE_ENV="development" (Windows)
- set NODE_ENV=development (Linux and Mac)
NOTE: you have to run the server first. To run the automated test you can just run:
npm test
and the results will be displayed at the console.