Encontre os endereços através do CEP.
Essa API está disponível Docker Hub: https://hub.docker.com/r/lagden/cep_consulta/
docker pull lagden/cep_consulta
Redis é requirido.
Exemplo utilizando docker run
.
docker network create cep-network
docker run --network cep-network --name cep-redis -d redis:6-alpine
docker run --network cep-network --name cep -p 30008:5000 --env REDIS=cep-redis:6379 -d lagden/cep_consulta:latest
Exemplo de um yaml
para ser utilizando com o docker compose
ou docker stack deploy
.
version: "3.7"
services:
redis:
image: redis:6-alpine
command: >
--appendonly yes
networks:
- net
volumes:
- db:/data
deploy:
restart_policy:
condition: on-failure
app:
image: docker.io/lagden/cep_consulta:latest
command: >
/bin/ash -c "
bin/helper/wait redis:6379;
node server
"
environment:
DEBUG_HIDE_DATE: 0
DEBUG_COLORS: 1
DEBUG_PREFIX: lagden_cep_consulta
DEBUG: lagden_cep_consulta:error
NODE_ENV: production
APP_ENV: production
APP_NS: lagden_cep_consulta
PORT: 30008
PORT_PUBLISHED: 30008
VERSION: release-8.1.1
#
CACHE_REDIS_NAMESPACE: lagden_cep_consulta
CACHE_REDIS_DB: 0
CLEAR_CACHE_FIRST_RUN: 0
#
REDIS: redis:6379
REDIS_HOST: redis
REDIS_PORT: 6379
ports:
- 30008:30008
networks:
- net
deploy:
resources:
limits:
cpus: '0.50'
memory: 200M
restart_policy:
condition: on-failure
networks:
net:
name: lagden_cep_consulta_net_production
volumes:
db:
name: lagden_cep_consulta_vol_production_db
curl 'http://127.0.0.1:30008/gql' \
-H 'content-type: application/json' \
-d '{
"source": "query Consulta($cep: String!) { consulta(cep: $cep) { endereco, bairro, cidade, uf } }",
"variableValues": {"cep": "01311-000"},
"operationName": "Consulta"
}' --compressed
{
"data": {
"consulta": {
"endereco": "Avenida Paulista",
"bairro": "Bela Vista",
"cidade": "São Paulo",
"uf": "SP"
}
}
}
MIT © Thiago Lagden