From 84c0b3e9e78766b40fcd3681689c5910d6263fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Thu, 18 Jun 2020 23:02:12 -0600 Subject: [PATCH 01/17] CREATE: tamplete profile --- src/index.ts | 2 +- src/profile.json | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/profile.json diff --git a/src/index.ts b/src/index.ts index 513b905..696e4c4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,6 +87,6 @@ server.post("/", async (req: Request, res: Response) => { } }); -server.listen("80", () => { +server.listen("80clear", () => { console.log("listening"); }); diff --git a/src/profile.json b/src/profile.json new file mode 100644 index 0000000..5ad5520 --- /dev/null +++ b/src/profile.json @@ -0,0 +1,29 @@ +{ + "contactInfo": { + "fullName": "", + "emailAddress": "" + }, + "github": { + "profileURL": "", + "username": "" + }, + "credentials": { + "password": "Cambia esta contraseña a una que sólo tú sepas", + }, + "personalInfo": { + "questions": [ + { + "question": "If I was a Sr. Programmer, I would like to build:", + "answer": "Respuesta: ..." + }, + { + "question": "Por favor indica el URL que me lleva a la línea de código de la definición de React.useEffect", + "answer": "Respuesta: ..." + }, + { + "question": "code is poetry, because:", + "answer": "Respuesta: ..." + } + ] + } +} \ No newline at end of file From bffa207cb277433c5130b797d736c995e7339a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Thu, 18 Jun 2020 23:25:52 -0600 Subject: [PATCH 02/17] UPDATE: profile info --- src/profile.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/profile.json b/src/profile.json index 5ad5520..1ffd01d 100644 --- a/src/profile.json +++ b/src/profile.json @@ -1,28 +1,28 @@ { "contactInfo": { - "fullName": "", - "emailAddress": "" + "fullName": "Luis Abel Pozuelos Juarez", + "emailAddress": "lpozuelos@irc.com.gt" }, "github": { - "profileURL": "", - "username": "" + "profileURL": "https://github.com/blindlp", + "username": "blindlp" }, "credentials": { - "password": "Cambia esta contraseña a una que sólo tú sepas", + "password": "Demo!@#$$..(*)" }, "personalInfo": { "questions": [ { "question": "If I was a Sr. Programmer, I would like to build:", - "answer": "Respuesta: ..." + "answer": "I create new application to bring more easily to solve problems in my field,sharing my knowledge and I trying to find new opportunities to develop business and create new sources of work." }, { "question": "Por favor indica el URL que me lleva a la línea de código de la definición de React.useEffect", - "answer": "Respuesta: ..." + "answer": "https://es.reactjs.org/docs/hooks-reference.html#useeffect" }, { "question": "code is poetry, because:", - "answer": "Respuesta: ..." + "answer": "it's poetry because you need to have different feelings to create and develop your abilities, I think is a king of art the way we express our code because its unique everybody has his own style" } ] } From 5db478c4d39ff8e21c2c1b00d6a49d9d237e4365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Thu, 18 Jun 2020 23:37:46 -0600 Subject: [PATCH 03/17] CRREATE: entry-challenge --- src/profile.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/profile.json b/src/profile.json index 1ffd01d..fece7d2 100644 --- a/src/profile.json +++ b/src/profile.json @@ -18,7 +18,7 @@ }, { "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://es.reactjs.org/docs/hooks-reference.html#useeffect" + "answer": "https://es.reactjs.org/docs/hooks-reference.html#useeffect " }, { "question": "code is poetry, because:", From 606b3e455606ef670c4d83835ab4f1dc14b83808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 12:21:17 -0600 Subject: [PATCH 04/17] CREATE: cleint.ts update port --- package.json | 1 + src/index.ts | 2 +- yarn.lock | 29 ++++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2bc6d97..34d284d 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "axios": "^0.19.2", "bcryptjs": "^2.4.3", "express": "^4.17.1", + "fetch": "^1.1.0", "ts-node-dev": "^1.0.0-pre.44" }, "prettier": { diff --git a/src/index.ts b/src/index.ts index 696e4c4..ce29439 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,6 +87,6 @@ server.post("/", async (req: Request, res: Response) => { } }); -server.listen("80clear", () => { +server.listen("8080", () => { console.log("listening"); }); diff --git a/yarn.lock b/yarn.lock index a12cac9..73f02e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -74,6 +74,13 @@ bcryptjs@^2.4.3: resolved "https://registry.yarnpkg.com/bcryptjs/-/bcryptjs-2.4.3.tgz#9ab5627b93e60621ff7cdac5da9733027df1d0cb" integrity sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms= +biskviit@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/biskviit/-/biskviit-1.0.1.tgz#037a0cd4b71b9e331fd90a1122de17dc49e420a7" + integrity sha1-A3oM1LcbnjMf2QoRIt4X3EnkIKc= + dependencies: + psl "^1.1.7" + body-parser@1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" @@ -219,6 +226,13 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= +encoding@0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= + dependencies: + iconv-lite "~0.4.13" + error-ex@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -282,6 +296,14 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== +fetch@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fetch/-/fetch-1.1.0.tgz#0a8279f06be37f9f0ebb567560a30a480da59a2e" + integrity sha1-CoJ58Gvjf58Ou1Z1YKMKSA2lmi4= + dependencies: + biskviit "1.0.1" + encoding "0.1.12" + filewatcher@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/filewatcher/-/filewatcher-3.0.1.tgz#f4a1957355ddaf443ccd78a895f3d55e23c8a034" @@ -386,7 +408,7 @@ http-errors@~1.7.2: statuses ">= 1.5.0 < 2" toidentifier "1.0.0" -iconv-lite@0.4.24: +iconv-lite@0.4.24, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -672,6 +694,11 @@ proxy-addr@~2.0.5: forwarded "~0.1.2" ipaddr.js "1.9.1" +psl@^1.1.7: + version "1.8.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== + punycode@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" From 9f9bec0f697ae6a26f82d7ddabb5ff6960310efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 12:27:44 -0600 Subject: [PATCH 05/17] CREATE: server url settings --- src/serverSettings.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/serverSettings.json diff --git a/src/serverSettings.json b/src/serverSettings.json new file mode 100644 index 0000000..ec14af6 --- /dev/null +++ b/src/serverSettings.json @@ -0,0 +1,4 @@ +{ + "url": "95.217.235.69", + "port": "80" +} \ No newline at end of file From 7da216a553b09f5815d53065afc9e3718ca524ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 12:34:39 -0600 Subject: [PATCH 06/17] UPDATE: add servicetag --- src/serverSettings.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/serverSettings.json b/src/serverSettings.json index ec14af6..a5baec8 100644 --- a/src/serverSettings.json +++ b/src/serverSettings.json @@ -1,4 +1,7 @@ { - "url": "95.217.235.69", - "port": "80" + "serviceSettings": { + "url": "95.217.235.69", + "port": "80" + } + } \ No newline at end of file From fea0faecd6674e61bcb2a568709b0c76d996db11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 13:08:15 -0600 Subject: [PATCH 07/17] CREATE: postProfile --- src/postProfile.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/postProfile.ts diff --git a/src/postProfile.ts b/src/postProfile.ts new file mode 100644 index 0000000..e44b5be --- /dev/null +++ b/src/postProfile.ts @@ -0,0 +1,27 @@ + +import { request } from "http"; + + +/** + * postProfile + * parameters url, port, json data + */ +export async function postProfile(url: string, port: number, profile: JSON) { + const req = request( + { + host: `${url}`, + port: `${port}`, + path: "/", + method: "POST", + headers: { + "Content-Type": "application/json", + }, + }, + (response) => { + console.table(response.statusCode); + }, + ); + req.write(JSON.stringify(profile)); + req.end(); + +} From d29cc629cbe959d81f7ca25f22718eb2d0472006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 13:10:17 -0600 Subject: [PATCH 08/17] CREATE: getProfile --- src/getProfile.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/getProfile.ts diff --git a/src/getProfile.ts b/src/getProfile.ts new file mode 100644 index 0000000..e69de29 From 854ef26152bfe6eec46a358887f55832f58fabe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 13:27:21 -0600 Subject: [PATCH 09/17] CREATE: getProfile, UPDATE:fix bug index --- src/getProfile.ts | 22 ++++++++++++++++++++++ src/index.ts | 2 +- src/profile.json | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/getProfile.ts b/src/getProfile.ts index e69de29..3a14edb 100644 --- a/src/getProfile.ts +++ b/src/getProfile.ts @@ -0,0 +1,22 @@ + +import { request } from "http"; + + +export async function getProfile(url: string, port: number, email: string, password: string) { + const req = request( + { + host: `${url}`, + port: `${port}`, + path: `/${email}`, + method: "GET", + headers: { + "Content-Type": "application/json", + "x-password": password, + }, + }, + (response) => { + console.log(response.statusCode); + }, + ); + req.end(); + } diff --git a/src/index.ts b/src/index.ts index ce29439..1209667 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import Ajv from "ajv"; import { compare, genSalt, hash } from "bcryptjs"; -import express from "express"; +import express, { Request, Response } from "express"; import fs from "fs"; import schema from "./schema.json"; import server from "./server"; diff --git a/src/profile.json b/src/profile.json index fece7d2..215cc44 100644 --- a/src/profile.json +++ b/src/profile.json @@ -26,4 +26,4 @@ } ] } -} \ No newline at end of file +} From f8d1cdb4ce38726f8096ff3b113d13d433f57a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 13:49:45 -0600 Subject: [PATCH 10/17] UPDATE: get profile --- src/getProfile.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/getProfile.ts b/src/getProfile.ts index 3a14edb..004b3e7 100644 --- a/src/getProfile.ts +++ b/src/getProfile.ts @@ -14,8 +14,9 @@ export async function getProfile(url: string, port: number, email: string, passw "x-password": password, }, }, + (response) => { - console.log(response.statusCode); + console.log(response.statusCode); }, ); req.end(); From 7089e76f36b86b639a6a1228739109d926919a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 14:11:00 -0600 Subject: [PATCH 11/17] UPDATE: comments --- src/getProfile.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/getProfile.ts b/src/getProfile.ts index 004b3e7..5e6145f 100644 --- a/src/getProfile.ts +++ b/src/getProfile.ts @@ -1,7 +1,10 @@ import { request } from "http"; - +/** + * postProfile + * parameters url, port, email, password + */ export async function getProfile(url: string, port: number, email: string, password: string) { const req = request( { From 335d75bc99c5438fea89b0c302dfc25038e9b5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Sat, 20 Jun 2020 14:12:17 -0600 Subject: [PATCH 12/17] UPDATE: comments files --- src/getProfile.ts | 5 ++++- src/postProfile.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/getProfile.ts b/src/getProfile.ts index 5e6145f..0aa701e 100644 --- a/src/getProfile.ts +++ b/src/getProfile.ts @@ -1,4 +1,7 @@ - +/** + * nombre: Luis Abel Pozuelos Juares + * correo: lpozuelos@irc.com.gt +*/ import { request } from "http"; /** diff --git a/src/postProfile.ts b/src/postProfile.ts index e44b5be..a5fb53b 100644 --- a/src/postProfile.ts +++ b/src/postProfile.ts @@ -1,4 +1,7 @@ - +/** + * nombre: Luis Abel Pozuelos Juares + * correo: lpozuelos@irc.com.gt +*/ import { request } from "http"; From f25f0c6a22c7b21c0feb06bfd813e20085aaa034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Mon, 22 Jun 2020 20:43:35 -0600 Subject: [PATCH 13/17] UPDATE: fix hardcore password checkout master index.ts --- package.json | 1 + src/index.ts | 4 ++-- src/profile.json | 4 ++-- yarn.lock | 5 +++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 34d284d..67f6cb0 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", "fetch": "^1.1.0", "ts-node-dev": "^1.0.0-pre.44" diff --git a/src/index.ts b/src/index.ts index 1209667..696e4c4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import Ajv from "ajv"; import { compare, genSalt, hash } from "bcryptjs"; -import express, { Request, Response } from "express"; +import express from "express"; import fs from "fs"; import schema from "./schema.json"; import server from "./server"; @@ -87,6 +87,6 @@ server.post("/", async (req: Request, res: Response) => { } }); -server.listen("8080", () => { +server.listen("80clear", () => { console.log("listening"); }); diff --git a/src/profile.json b/src/profile.json index 215cc44..9adb6fd 100644 --- a/src/profile.json +++ b/src/profile.json @@ -1,14 +1,14 @@ { "contactInfo": { "fullName": "Luis Abel Pozuelos Juarez", - "emailAddress": "lpozuelos@irc.com.gt" + "emailAddress": "" }, "github": { "profileURL": "https://github.com/blindlp", "username": "blindlp" }, "credentials": { - "password": "Demo!@#$$..(*)" + "password": "" }, "personalInfo": { "questions": [ diff --git a/yarn.lock b/yarn.lock index 73f02e9..7288e28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -209,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@^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" From 69c5e38ea112434183b8c67550b1d2761cc591ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Tue, 23 Jun 2020 00:59:16 -0600 Subject: [PATCH 14/17] DELETE: delete server settins move to env. UPDATE: profile FIX: getProfile move functios to axios UPDATE: fix postProfiel move to axios --- src/getProfile.ts | 32 ++++++++++++++------------------ src/index.ts | 4 ++-- src/postProfile.ts | 31 +++++++++++-------------------- src/profile.json | 2 +- src/serverSettings.json | 7 ------- 5 files changed, 28 insertions(+), 48 deletions(-) delete mode 100644 src/serverSettings.json diff --git a/src/getProfile.ts b/src/getProfile.ts index 0aa701e..3c51403 100644 --- a/src/getProfile.ts +++ b/src/getProfile.ts @@ -3,27 +3,23 @@ * correo: lpozuelos@irc.com.gt */ import { request } from "http"; +import axios from 'axios' /** * postProfile * parameters url, port, email, password */ -export async function getProfile(url: string, port: number, email: string, password: string) { - const req = request( - { - host: `${url}`, - port: `${port}`, - path: `/${email}`, - method: "GET", - headers: { - "Content-Type": "application/json", - "x-password": password, - }, - }, - (response) => { - console.log(response.statusCode); - }, - ); - req.end(); - } +export async function getProfile(url: string, email: string, passowrd: string) { + + axios + .get(`http://${url}/` + email, { + headers: { "Content-Type": "application/json", "x-password": passowrd }, + }) + .then((res) => { + console.log(res.data.bienvenido.claveDeAcceso); + }) + .catch((error) => { + console.log("error " + error); + }); +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 696e4c4..e66ade9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,7 +18,7 @@ server.get("/:emailAddress", async (req: Request, res: Response) => { const getData = (): Promise => new Promise((resolve, reject) => { - fs.readFile(`./data/${req.params.emailAddress}.json`, "utf8", (err, data) => { + fs.readFile(`./data/${req.conact.emailAddress}.json`, "utf8", (err, data) => { if (Boolean(err)) { reject(new Error("Correo inválido.")); } @@ -87,6 +87,6 @@ server.post("/", async (req: Request, res: Response) => { } }); -server.listen("80clear", () => { +server.listen("8080", () => { console.log("listening"); }); diff --git a/src/postProfile.ts b/src/postProfile.ts index a5fb53b..7ff3de5 100644 --- a/src/postProfile.ts +++ b/src/postProfile.ts @@ -2,29 +2,20 @@ * nombre: Luis Abel Pozuelos Juares * correo: lpozuelos@irc.com.gt */ -import { request } from "http"; +import axios from 'axios' /** * postProfile - * parameters url, port, json data + * parameters url, json data */ -export async function postProfile(url: string, port: number, profile: JSON) { - const req = request( - { - host: `${url}`, - port: `${port}`, - path: "/", - method: "POST", - headers: { - "Content-Type": "application/json", - }, - }, - (response) => { - console.table(response.statusCode); - }, - ); - req.write(JSON.stringify(profile)); - req.end(); +export async function postProfile(url, profile) { -} + axios.post(`http://${url}/`, profile) + .then((res) => { + console.log(res.status); + }) + .catch((err) => { + console.error("error " + err); + }); +} \ No newline at end of file diff --git a/src/profile.json b/src/profile.json index 9adb6fd..abf5b70 100644 --- a/src/profile.json +++ b/src/profile.json @@ -1,7 +1,7 @@ { "contactInfo": { "fullName": "Luis Abel Pozuelos Juarez", - "emailAddress": "" + "emailAddress": "lpozuelos@irc.com.gt" }, "github": { "profileURL": "https://github.com/blindlp", diff --git a/src/serverSettings.json b/src/serverSettings.json deleted file mode 100644 index a5baec8..0000000 --- a/src/serverSettings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "serviceSettings": { - "url": "95.217.235.69", - "port": "80" - } - -} \ No newline at end of file From 9f24b39adee3220eb8b0c13db02744ea0b3ebab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Tue, 23 Jun 2020 14:31:44 -0600 Subject: [PATCH 15/17] UPDATE: cliente.ts --- .gitignore | 1 - src/client.ts | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/client.ts diff --git a/.gitignore b/.gitignore index a91eeca..e2b43fa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ /node_modules /dist /data -src/client.ts \ No newline at end of file diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 0000000..6fce862 --- /dev/null +++ b/src/client.ts @@ -0,0 +1,21 @@ +/** + * nombre: Luis Abel Pozuelos Juares + * correo: lpozuelos@irc.com.gt +*/ + +// import post profile function +import { postProfile } from "./postProfile"; +// import get profile funtion +import { getProfile } from "./getProfile"; +// envieroment vars +require('dotenv').config(); +//importamos informacion del perfil +const profile = require("./profile.json"); + + +profile.credentials.password = process.env.CLAVE; +//call function PostProfile +postProfile(process.env.URL, profile); +//call gunction getProfile +getProfile(process.env.URL,profile.contactInfo.emailAddress,process.env.CLAVE) + From 5e1bc35f765afa17cffc8f30a45cdb3f35e8edd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Tue, 23 Jun 2020 15:16:15 -0600 Subject: [PATCH 16/17] UPDATE: server port --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e66ade9..671e046 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,6 +87,6 @@ server.post("/", async (req: Request, res: Response) => { } }); -server.listen("8080", () => { +server.listen("80", () => { console.log("listening"); }); From ff5d70f3420518798a3c08d1e07a1e8b0d4597de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cblindlp=E2=80=9D?= <“luispoz@gmail.com”> Date: Tue, 23 Jun 2020 15:34:01 -0600 Subject: [PATCH 17/17] UPDATE: format prettier CODE --- package.json | 1 + src/client.ts | 12 +++++------- src/getProfile.ts | 13 ++++++------- yarn.lock | 5 +++++ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 67f6cb0..761caa5 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "dotenv": "^8.2.0", "express": "^4.17.1", "fetch": "^1.1.0", + "prettier": "^2.0.5", "ts-node-dev": "^1.0.0-pre.44" }, "prettier": { diff --git a/src/client.ts b/src/client.ts index 6fce862..8d15112 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,21 +1,19 @@ -/** - * nombre: Luis Abel Pozuelos Juares +/** + * nombre: Luis Abel Pozuelos Juares * correo: lpozuelos@irc.com.gt -*/ + */ // import post profile function import { postProfile } from "./postProfile"; // import get profile funtion import { getProfile } from "./getProfile"; // envieroment vars -require('dotenv').config(); +require("dotenv").config(); //importamos informacion del perfil const profile = require("./profile.json"); - profile.credentials.password = process.env.CLAVE; //call function PostProfile postProfile(process.env.URL, profile); //call gunction getProfile -getProfile(process.env.URL,profile.contactInfo.emailAddress,process.env.CLAVE) - +getProfile(process.env.URL, profile.contactInfo.emailAddress, process.env.CLAVE); diff --git a/src/getProfile.ts b/src/getProfile.ts index 3c51403..d6298d6 100644 --- a/src/getProfile.ts +++ b/src/getProfile.ts @@ -1,9 +1,9 @@ -/** - * nombre: Luis Abel Pozuelos Juares +/** + * nombre: Luis Abel Pozuelos Juares * correo: lpozuelos@irc.com.gt -*/ + */ import { request } from "http"; -import axios from 'axios' +import axios from "axios"; /** * postProfile @@ -11,9 +11,8 @@ import axios from 'axios' */ export async function getProfile(url: string, email: string, passowrd: string) { - axios - .get(`http://${url}/` + email, { + .get(`http://${url}/` + email, { headers: { "Content-Type": "application/json", "x-password": passowrd }, }) .then((res) => { @@ -22,4 +21,4 @@ export async function getProfile(url: string, email: string, passowrd: string) { .catch((error) => { console.log("error " + error); }); -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 7288e28..189748f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -691,6 +691,11 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= +prettier@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" + integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== + proxy-addr@~2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"