- Instalar TypeScript y demás dependencias
npm i -D typescript @types/node ts-node-dev rimraf
- Inicializar el archivo de configuración de TypeScript ( Se puede configurar al gusto)
npx tsc --init --outDir dist/ --rootDir src
| import { bcryptAdapter } from '../../config'; | |
| export const seedData = { | |
| users: [ | |
| { name: 'Test 1', email: 'test1@google.com', password: bcryptAdapter.hash( '123456') }, | |
| { name: 'Test 2', email: 'test2@google.com', password: bcryptAdapter.hash( '123456') }, | |
| { name: 'Test 3', email: 'test3@google.com', password: bcryptAdapter.hash( '123456') }, |
| export const isValidEmail = (email: string): boolean => { | |
| const match = String(email) | |
| .toLowerCase() | |
| .match( | |
| /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ | |
| ); |
| export const helpHttp = () => { | |
| const customFetch = (endpoint, options) => { | |
| const defaultHeader = { | |
| accept: "application/json", | |
| }; | |
| const controller = new AbortController(); | |
| options.signal = controller.signal; | |
| options.method = options.method || "GET"; |
| * { | |
| font-family: Helvetica, Arial, sans-serif; | |
| font-weight: 200; | |
| } | |
| html, body { | |
| background: white; | |
| margin: 20px; | |
| color: #3e4144; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <!-- Cargat React --> | |
| <script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> | |
| <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script> | |
| <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> |