Authenticate your account do Twitter and create Tweets with weather information for a particular region provided by OpenWeatherMap.
In the twitter authentication settings, remember to configure the callback route as in the example below:
Inside the project directory:
Copy the .env
to configure with database credentials and your Twitter and OpenWeatherMap API keys:
cp .env.sample .env
Make sure you have Docker and Docker-Compose installed on your machine!
But, if you haven't installed it yet, I recommend the links below for installation using Ubuntu 20.04:
Install Docker: Click here!
Install Docker-compose: Click here!
Run to build the docker image and install dependences:
make build
Now, whenever you want to go up to the API, run the command:
make up
If you want to run the tests:
make run_tests
Depending on the OS, there may be difficulties in executing the commands, if it happens, check the desired tag in the Makefile file and execute it manually!
Then go up Application, now with the request below authenticate your twitter account:
curl --location 'http://localhost:3000/authorize' \
--header 'Accept: application/vnd.owm-bot-api.v1'
With the token in hand, create Tweets based on weather information for a given region, passing latitude and longitude or region name as parameters:
curl --location 'http://localhost:3000/tweets?token=YOUR_TOKEN' \
--header 'Accept: application/vnd.owm-bot-api.v1' \
--header 'Content-Type: application/json' \
--data '{
"location": {
"lat": -5.09
"lon": -42.80
// "name": "City Name"
}
}'
Or if you prefer, access the Swagger UI with http://localhost:3000/api-docs and make the requests
MIT
Free Software, Hell Yeah!