Urgent.News

What's breaking now, across thousands of outlets.

Tech

Parte 2: Resolvendo o Desafio Técnico de Backend do PicPay

Iniciando o projeto. Pra iniciar o projeto, use o comando npm init -y Por que usaremos o docker para o banco? Ao inves de instalar o postgres na nossa maquina(é um inferno instalar isso), a gente subimos ele pra dentro de um container , um ambiente isolado, facil de criar e destruir, e o melhor, ja vem tudo configurado kaka. O arquivo que vamos criar é o docker-compose.yml Esse arquivo vai…

In the second part of resolving PicPay's backend technical challenge, the focus is on using Docker for the database. Instead of installing PostgreSQL on the local machine, the database is now run inside a container, an isolated environment that's easy to create and destroy. The main file for this setup is docker-compose.yml, which is created at the root of the project.

Docker compose simplifies the process by caring for the creation and deployment of everything in a single command after defining the services in the docker-compose.yml file. For the database, the image used is postgres:16, and the container is named picpay_db. The container is set to always restart if it crashes or the PC is restarted.

Environment variables such as the user, password, and database name are defined for Postgres to configure itself upon its first run. The database is accessible on localhost:5432, and the data volume is set to prevent loss when the container is recreated.

The docker-compose.yml file is structured with services, which in this case is the db service, and within it, the image, container name, restart policy, environment variables, ports, and volumes are defined. The docker-compose.yml file is then created at the project's root, and the command docker compose up -d is executed to deploy the services as described in the file.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Leetcode 41 : First Missing Positive Integer

Question : Given an unsorted integer array, find the smallest missing positive integer. Example : Input: [1,2,0] Output: 3 Input: [3,4,-1,1] Output: 2 Input: [7,8,9,11,12] Output: 1 Idea : In 1st…

More from Sunday 23 August →