A simple Laravel Project to build foundational knowledge using ViaCEP API for fetching data.
ViaCEP API Docs: https://viacep.com.br/
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/your-username/Laravel-ViaCEP-API.git cd Laravel-ViaCEP-API -
Copy the .env.example file to .env and edit the database configuration:
cp .env.example .env
Edit the .env file to match your database configuration.
-
Build the Docker containers:
docker-compose build
-
Start the Docker containers:
docker-compose up -d
-
Access the application container:
docker-compose exec app bash -
Install PHP dependencies:
composer install
-
Generate the application key:
php artisan key:generate
-
Run the database migrations:
php artisan migrate
-
Install Node.js dependencies and build assets:
npm install npm run build
-
Access the application:
Open your browser and navigate to
http://localhost:8000.
This project uses the ViaCEP API to fetch and store Brazilian postal code (CEP) data. Users can search for CEP information by entering a CEP directly or by providing a combination of state (UF), city (localidade), and street (logradouro). The application ensures that each user can only store unique CEP data.
- Search for CEP information using the ViaCEP API.
- Store CEP data in the database.
- Ensure unique CEP data per user.
- Toggle between searching by CEP and searching by UF, localidade, and logradouro.
GET /ceps- List all CEPs for the authenticated user.POST /ceps- Store a new CEP for the authenticated user.POST /ceps/store-multiple- Store multiple CEPs for the authenticated user based on UF, localidade, and logradouro.