A simple application that searches county info by code.
- County APP
Just a simple page with a field to input the county code that you wants to look for.
The page is reactive, so, after the search about the county code, the result will appear in the same page without reload or redirect 🔁.
I'm providing two types of documentation:
1 - In the Open API 3.x standard, you can access here
2 - In a temporary developer portal that I've published with APIMATIC, you can access here
1 - There is a simple HTTP route called SEARCH_COUNTY_CODE
:
/search/county/{code}
⚠️ The "code" must be one of the allowed values (we validate received codes), check the CountyCodeEnum.php for more details.
2 - This route will search an external API, getting info about the county.
3 - The result is parsed and returned for you.
There are two external APIs:
1 - Brasil API
2 - IBGE API (Do not use!)
We can define the API to search by the COUNTY_SERVICE
environment variable, that can be brasil_api
or ibge_api
.
The IBGE API is running an old SSL and TLS version that are vulnerable to renegotiation attacks as described in RFC 5746.
This project is using a recent version of CURL that by default does not request URLs running vulnerable SSL/TLS Versions, you can try in our own terminal running for example: curl https://servicodados.ibge.gov.br/api/v1/localidades/estados/sp/municipios
, you'll get something like: OpenSSL/3.0.8: error:0A000152:SSL routines::unsafe legacy renegotiation disabled
.
There is a way to disable this behaviour of CURL, but, disabling security resources is never recommended.
So, this is why the IbgeCountyService are currently blocked.
- Laravel 10.
- Swoole (through Laravel Octane).
- Livewire 3.
- TailwindCss.
- Pest for unit and functional tests.
- Redis for caching.
- Docker & Docker Compose for application containerization.
- Github Actions for CI/CD.
Everything is containerized, so it's pretty easy. You do not even need PHP installed on your machine, just docker.
1 - First, build the environment:
make build
⚠️ This command you just need to run once, if you alread runned this, you can start from step 2.
2 - Now, you can just start the back and front-end servers with:
make up_d
3 - Run the tests to check if everything is ok:
make test
4 - To stop the application:
make stop
From now, everything you want to run in the PHP inside the Laravel container you can do with
vendor/bin/sail <command>
, example:vendor/bin/sail artisan make:model MyModel
.