Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

/node_modules
/dist
/data
src/client.ts
/data
85 changes: 1 addition & 84 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1 @@
# Prueba de acceso a core-code.io v20.06.11
Comment thread
areyes107 marked this conversation as resolved.

Welcome to Core Code entry challenge.

Please follow the instructions and submit them before 2020/06/24.

## Instructions

### 1. Haz un fork de este repositorio

Una vez creado el fork, clonarás el proyecto en tu máquina y crearás un file: `./src/client.ts` que haga lo siguiente:

### 2. Send a POST request to `http://95.217.235.69/` with the following data:

```
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: ...",
},
],
},
```

### 2. Verify that your information was saved successfully

Send a GET request to the URL `http://95.217.235.69/:emailAddress` with the following headers:

```
{
"Content-Type": "application/json",
"x-password": "tu contraseña especificada en el paso anterior"
}
```

The URL param `emailAddress` should be the email address you specified in the previous POST request.

### 3. Ya casi

You should get a response with a valid `claveDeAcceso`.

### 4. Crea un pull-request de tu fork al repo original

Tu branch deberá llamarse: `<github-username>/entry-challenge`, y el pull-request deberá asignarse hacia `master` del repo original.

### 5. Envía la contraseña y la solución

Send an email to `gus@core-code.io`, cc'd to `sc@core-code.io`, with the following information:

Asunto: `emailAddress@claveDeAcceso`

El cuerpo del mensaje debe contener un link al pull-request.

### 6. Espera los comentarios

y resuélvelos hasta que tu PR sea aprobado.

### 5. Espera la invitación de Github a tu correo registrado (Si no la recibes, es porque no te hemos aceptado)

Agregaremos tu usuario de Github a la organización de [corecodeio](https://github.com/corecodeio).
También te agendaremos una reunión de bienvenida para el día 29 de junio.

### Estás muy cerca de comenzar tu carrera de Software con Core Code.
# Reto Completado
62 changes: 62 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const axios = require('axios');
Comment thread
areyes107 marked this conversation as resolved.
Outdated

const data = {
Comment thread
areyes107 marked this conversation as resolved.
Outdated
"contactInfo": {
"fullName": "Saul Lopez",
"emailAddress": "saullopezc@gmail.com"
},
"github": {
"profileURL": "https://github.com/saullopezc",
"username": "saullopezc"
},
"credentials": {
"password": "YwQuIzgsSTyDURgXq9Ot"
Comment thread
areyes107 marked this conversation as resolved.
Outdated
},
"personalInfo": {
"questions": [
{
"question": "If I was a Sr. Programmer, I would like to build:",
"answer": "Paquetes o librerias "
},
{
"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"
},
{
"question": "code is poetry, because:",
"answer": "Por la expresion y la belleza del codigo"
}
]
}
};

export const createProfile = async () => {
try {
const res = await axios.post('http://95.217.235.69/', data);
console.log(`Status: ${res.status}`);
console.log('Body: ', res.data);
listProfile();
} catch (err) {
console.error(err);
}
};

export const listProfile = () => {
Comment thread
areyes107 marked this conversation as resolved.
Outdated

const URL = "http://95.217.235.69/saullopezc@gmail.com"
/*var myHeaders = new Headers();
Comment thread
areyes107 marked this conversation as resolved.
Outdated
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-password", "YwQuIzgsSTyDURgXq9Ot");
console.log(myHeaders);*/
axios.get(URL, {
headers: {"x-password": "YwQuIzgsSTyDURgXq9Ot", "Content-Type": "application/json" }})
.then(response => {
// If request is good...
console.log(response.data);

})
.catch((error) => {
console.log('error ' + error);
});

};
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import express from "express";
import fs from "fs";
import schema from "./schema.json";
import server from "./server";
import {listProfile ,createProfile} from "./client";
Comment thread
areyes107 marked this conversation as resolved.
Outdated


export const router = express.Router({
strict: true,
Expand Down Expand Up @@ -90,3 +92,9 @@ server.post("/", async (req: Request, res: Response) => {
server.listen("80", () => {
console.log("listening");
});

const ejecutar_cliente = () => {
console.log(createProfile());
};

ejecutar_cliente();