Skip to content

solicitud#15

Open
jelg14 wants to merge 2 commits into
corecodeio:masterfrom
jelg14:master
Open

solicitud#15
jelg14 wants to merge 2 commits into
corecodeio:masterfrom
jelg14:master

Conversation

@jelg14
Copy link
Copy Markdown

@jelg14 jelg14 commented Jun 22, 2020

No description provided.

Comment thread src/client.ts
}

postData();
var s = 0 No newline at end of file
Copy link
Copy Markdown

@danbart danbart Jun 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

te sugiero que elimines variables innecesarias y que ejecutes la función de getData() dentro de este archivo

Suggested change
var s = 0
getData()

Comment thread src/index.ts
import Ajv from "ajv";
import { compare, genSalt, hash } from "bcryptjs";
import express from "express";
import express, { Request, Response } from "express";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

las importaciones de Request y Response son innecesarias, tienes que regresar este archivo a su estado original, para esto intenta hacer un git checkout master src/index.ts.

Suggested change
import express, { Request, Response } from "express";
import express from "express";

Comment thread src/client.ts

function getData() {
axios.get(`http://95.217.235.69/${process.env.EMAIL}`,{

Copy link
Copy Markdown

@danbart danbart Jun 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

te recomiendo instalar la extensión prettier en tu editor para aplicarlo en los archivos de client.ts y data.json

en el archivo settings.json de tu editor agrega lo siguiente:

"editor.codeActionsOnSave": {
    "source.organizeImports": true
  },

Copy link
Copy Markdown

@danbart danbart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excelente comienzo revisa y resuelve los comentarios a continuación.

Copy link
Copy Markdown

@pugaIsaias pugaIsaias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hola @jelg14, vamos a intentar mejorar tu código un poco. Listó?

Comment thread src/datos.json
Comment on lines +10 to +11
"credentials": {
"password": "asdf"
Copy link
Copy Markdown

@pugaIsaias pugaIsaias Jun 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"credentials": {
"password": "asdf"
"credentials": {
"password": ""

Ingresar la contraseña directamente desde el código es una mala practica de seguridad. Y veo que al parecer tambien la tienes guardado en process.env.PASSWORD. Lo cual es correcto.

Por favor puedes borrar la contraseña del .json. Y realizar los cambios necesarios en tu código para que continué funcionando.

Sugerencia: Para evitar redundancias, mantenerlo modular, y no manipular mucho de los datos dentro del client.ts. Y ya que no se pueden asignar valores desde el datos.json, puedes utilizar un datos.ts para asignar los valores necesarios para el POST. He importar para utilizar en client.ts.

Comment thread src/client.ts
Comment on lines +17 to +22
axios.get(`http://95.217.235.69/${process.env.EMAIL}`,{


headers:{
"Content-Type": "application/json",
"x-password": process.env.PASSWORD,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
axios.get(`http://95.217.235.69/${process.env.EMAIL}`,{
headers:{
"Content-Type": "application/json",
"x-password": process.env.PASSWORD,
axios.get("http://95.217.235.69/"+data.contactInfo.emailAddress,{
headers:{
"Content-Type": "application/json",
"x-password": data.credentials.password,

Para mantenerse consistente, y no causar mal entendidos; como que process.env.EMAIL en GET no es igual a data.contactInfo.emailAddress en POST, y que no estamos buscando dos cosas totalmente diferente.

Sugerencia: podemos utilizar la misma variable importada de datos para llenar los parámetros tanto del POST como el GET.

Comment thread package.json
"nodemon": "^2.0.4",
"ts-node-dev": "^1.0.0-pre.44"
},
"prettier": {
Copy link
Copy Markdown

@pugaIsaias pugaIsaias Jun 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veo que ya instalaste prettier pero creo que no se esta aplicando el formato, por los espacios en blanco en tu codigo.

Sugerencia: Puedes colocar el siguiente codigo que me funciono en los setting.json de tu editor:

"editor.codeActionsOnSave": {
		"source.organizeImports": true
	},
"editor.formatOnSave": true,

Copy link
Copy Markdown

@netpoe netpoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jelg14 vas por buen camino.
por favor resuelve los comentarios.

@pugaIsaias @danbart asegúrense de darle seguimiento a los cambios de código.
marquen como Resolve Conversation los cambios que se hayan realizado después de sus observaciones.

Comment thread src/server.ts
Comment on lines 2 to +6
export const server = express();
server.use(express.json());

export default server; No newline at end of file
export default server;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No es necesario modificar este file, por favor devuélvelo a su estado original.

Comment thread src/schema.json
@@ -5,37 +5,34 @@
"title": "The root schema",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deja sólo la data necesaria, en este caso tu data.

Comment thread src/client.ts


async function postData() {
axios.post('http://95.217.235.69/',datos)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
axios.post('http://95.217.235.69/',datos)
axios.post('http://95.217.235.69/', datos)

ya instalaste prettier?

Comment thread package-lock.json
@@ -0,0 +1,1875 @@
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este file no es necesario. Estamos trabajando con yarn. Quítalo del PR por favor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants