const Calc = {
sum: (...arg) => arg.reduce((acc, num) => acc + num, 0),
sub: (...arg) => arg.reduce((acc, num) => acc - num),
mul: (...arg) => arg.reduce((acc, num) => acc * num, 1),
div: (...arg) => arg.reduce((acc, num) => acc / num),
}
const num1 = 10;
const num2 = 5;
- Tener instalado Node.js (18 o superior) 👉 sitio oficial
- Descargar e Instalar Docker (24 o superior) 👉 sitio oficial
Ejecutar este comando en la terminal y si hay respuesta, está instalado.
docker -v
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
postgres-db: | |
image: postgres:15.3 | |
restart: always | |
environment: | |
POSTGRES_USER: ${POSTGRES_USER} | |
POSTGRES_DB: ${POSTGRES_DB} | |
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IsString() | |
@MinLength(6) | |
@MaxLength(50) | |
@Matches( | |
/(?:(?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/, { | |
message: 'The password must have a Uppercase, lowercase letter and a number' | |
}) | |
password: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ##### CREACIÓN DE LA BASE DE DATOS: | |
CREATE DATABASE desafio3_felipe_jofre_000; | |
-- Para usar la base de datos utilizar comando: | |
-- \c desafio3_felipe_jofre_000 |
En este desafío se ponen a prueba algunos conocimientos SQL para hacer consultas con funciones de agrupación como SUM, COUNT, AVG y además las cláusulas ORDER BY o GRUP BY, etc. Todo el desafío queda explicado en este archivo PDF
- ¿Cuántos registros hay?
SELECT COUNT(*)
Documentación oficial sobre Jest
- Instalaciones de desarrollo (super test es útil para probar Express)
npm install -D jest @types/jest ts-jest supertest
Más información - Docs Oficiales
- Instalar TypeScript y tipos de Node, como dependencia de desarrollo
npm i -D typescript @types/node
- Inicializar el archivo de configuración de TypeScript ( Se puede configurar al gusto)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- CREA UNA TABLA LLAMADA users | |
CREATE TABLE IF NOT EXISTS "users" ( | |
id SERIAL, | |
name VARCHAR(100) UNIQUE NOT NULL, | |
role VARCHAR(15) NOT NULL, | |
PRIMARY KEY (id) | |
); | |
-- INSERTA REGISTROS EN LA TABLA users | |
INSERT INTO "users" (name, role) VALUES ('Felipe', 'ROLE_ADMIN'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
myDB: | |
image: postgres:15.3 | |
container_name: my-database | |
restart: always | |
ports: | |
- 5432:5432 | |
environment: |
NewerOlder