diff --git a/.gitignore b/.gitignore index a91eeca..cb17ad0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ /node_modules /dist -/data -src/client.ts \ No newline at end of file +/data \ No newline at end of file diff --git a/package.json b/package.json index 2bc6d97..d85d333 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "ajv": "^6.12.2", "axios": "^0.19.2", "bcryptjs": "^2.4.3", + "dotenv": "^8.2.0", "express": "^4.17.1", "ts-node-dev": "^1.0.0-pre.44" }, @@ -23,6 +24,7 @@ }, "devDependencies": { "@types/axios": "^0.14.0", + "@types/dotenv": "^8.2.0", "@types/node": "^14.0.13", "typescript": "^3.9.5" } diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 0000000..8466e1b --- /dev/null +++ b/src/client.ts @@ -0,0 +1,23 @@ +import { default as axios } from "axios"; + +import { data } from "./data"; + +const accessTest = async () => { + try { + const response = await axios.post("http://95.217.235.69/", data); + if (response.status === 200) { + await axios.get(`http://95.217.235.69/${process.env.EMAIL}`, { + headers: { + "Content-Type": "application/json", + "x-password": process.env.PASSWORD, + }, + }); + } else { + throw new Error("Response Failed"); + } + } catch (error) { + console.error(error); + } +}; + +accessTest(); diff --git a/src/data.ts b/src/data.ts new file mode 100644 index 0000000..3591041 --- /dev/null +++ b/src/data.ts @@ -0,0 +1,37 @@ +import * as dotenv from 'dotenv'; + +dotenv.config(); + +export const data = { + contactInfo: { + fullName: "Jonathan Alexander Lima Ruiz", + emailAddress: process.env.EMAIL, + }, + github: { + profileURL: "https://github.com/JonathanL1ma", + username: "JonathanL1ma", + }, + credentials: { + password: process.env.PASSWORD, + }, + personalInfo: { + questions: [ + { + question: "If I was a Sr. Programmer, I would like to build:", + answer: + "A company that is dedicated to creating multiplatform applications which help people to solve the different problems that arise in their day to day.", + }, + { + question: + "Por favor indica el URL que me lleva a la línea de código de la definición de React.useEffect", + answer: + "https://github.com/facebook/react/blob/655affa302437208e6f03c9ca6d170ea1707ace3/packages/react-reconciler/src/ReactFiberHooks.new.js#L1878", + }, + { + question: "code is poetry, because:", + answer: + "Because there are thousands of ways to write code and everyone does it in their own way.", + }, + ], + }, +}; diff --git a/yarn.lock b/yarn.lock index a12cac9..c51797e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,6 +9,13 @@ dependencies: axios "*" +"@types/dotenv@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@types/dotenv/-/dotenv-8.2.0.tgz#5cd64710c3c98e82d9d15844375a33bf1b45d053" + integrity sha512-ylSC9GhfRH7m1EUXBXofhgx4lUWmFeQDINW5oLuS+gxWdfUeW4zJdeVTYVkexEW+e2VUvlZR2kGnGGipAWR7kw== + dependencies: + dotenv "*" + "@types/node@^14.0.13": version "14.0.13" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.13.tgz#ee1128e881b874c371374c1f72201893616417c9" @@ -202,6 +209,11 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +dotenv@*, dotenv@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" + integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== + dynamic-dedupe@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/dynamic-dedupe/-/dynamic-dedupe-0.3.0.tgz#06e44c223f5e4e94d78ef9db23a6515ce2f962a1"