diff --git a/.gitignore b/.gitignore index a91eeca..7811eef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .env +.env.production /node_modules /dist /data -src/client.ts \ No newline at end of file +.idea diff --git a/package.json b/package.json index 2bc6d97..8068092 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,11 @@ "author": "netpoe", "license": "ISC", "dependencies": { + "@types/dotenv": "^8.2.0", "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" }, @@ -24,6 +26,7 @@ "devDependencies": { "@types/axios": "^0.14.0", "@types/node": "^14.0.13", + "prettier": "^2.0.5", "typescript": "^3.9.5" } } diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 0000000..2a36534 --- /dev/null +++ b/src/client.ts @@ -0,0 +1,33 @@ +import axios from "axios"; +import { data } from "./data"; + +postData(); +getData(); + +async function postData() { + axios + .post("http://95.217.235.69/", data) + .then((res) => { + console.log(res); + }) + .catch((err) => { + console.log(err); + }); +} + +async function getData() { + const URL = "http://95.217.235.69/"; + axios + .get(URL + data.contactInfo.emailAddress, { + headers: { + "x-password": data.credentials.password, + "Content-Type": "application/json", + }, + }) + .then((res) => { + console.log(res); + }) + .catch((err) => { + console.log(err); + }); +} diff --git a/src/data.ts b/src/data.ts new file mode 100644 index 0000000..57ed0a3 --- /dev/null +++ b/src/data.ts @@ -0,0 +1,34 @@ +import { PASSWORD_ENV } from "./utils/config"; + +export const data = { + contactInfo: { + fullName: "Jimmy Ottoniel Gabriel Roquel", + emailAddress: "jimmyottonielgr@gmail.com", + }, + github: { + profileURL: "https://github.com/Jimmygabriel", + username: "Jimmygabriel", + }, + credentials: { + password: `${PASSWORD_ENV}`, + }, + personalInfo: { + questions: [ + { + question: "If I was a Sr. Programmer, I would like to build:", + answer: "Reverse engineering tool development :'D", + }, + { + 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: + "The overflow of the soul, a lucid dream, the spirit of the developer. Of what is not yet, but already is, before it was.", + }, + ], + }, +}; diff --git a/src/utils/config.ts b/src/utils/config.ts new file mode 100644 index 0000000..70988e7 --- /dev/null +++ b/src/utils/config.ts @@ -0,0 +1,7 @@ +import * as dotenv from "dotenv"; + +dotenv.config(); +let path = `${__dirname}/../../.env`; +dotenv.config({ path: path }); + +export const PASSWORD_ENV = process.env.PASSWORD_ENV;