This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { ActivityIndicator, Text, View } from 'react-native' | |
| import httpClient from '../services/axios-client' | |
| export default class AxiosExample extends React.Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| isLoading: true, | |
| planetName: '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios from 'axios' | |
| const urlBase = 'https://swapi.co/api' | |
| /** | |
| * @param {string} url url a la cual consultar | |
| * esta funcion detecta si es una nueva url base (comienza con http:// o https://). | |
| * en caso de ser asi, retorna la url. en caso contrario, se asume que es un fragmento | |
| * de path por lo que se concatena con la constante urlBase | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const urlBase = 'https://swapi.co/api' | |
| /** | |
| * @param {string} url url a la cual consultar | |
| * esta funcion detecta si es una nueva url base (comienza con http:// o https://). | |
| * en caso de ser asi, retorna la url. en caso contrario, se asume que es un fragmento | |
| * de path por lo que se concatena con la constante urlBase | |
| **/ | |
| const readUrl = (url = '') => | |
| url.startsWith('http://') || url.startsWith('https://') ? url : `${urlBase}/${url}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { ActivityIndicator, Text, View } from 'react-native' | |
| import httpClient from '../services/fetch-client' | |
| export default class FetchExample extends React.Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| isLoading: true, | |
| planetName: '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:latest | |
| # Este dockerfile asume que es un proyecto cuya tarea principal es npm start | |
| # con un script de "prestart": "npm install" dentro del package.json | |
| # y que expone el puerto 9999 | |
| # importante que si el script "start" de package.json ejecuta a webpack-dev-server hay que incluir --host 0.0.0.0 | |
| # sin esto ultimo, el contenido publicado por webpack-dev-server no se puede ver desde el exterior | |
| # en caso de usar react-scripts, hay que crear un archivo .env que contenga la variable HOST = 0.0.0.0 | |
| # este archivo debe estar ubicado en la misma carpeta que package.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM maven:latest | |
| # Este dockerfile asume que es un proyecto de spring boot | |
| # ejecutable con spring-boot:run, y que utiliza el puerto 8080 | |
| RUN mkdir -p /usr/src/project | |
| COPY ./ /usr/src/project | |
| WORKDIR /usr/src/project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM gradle:latest | |
| # Este dockerfile asume que es un proyecto de spring boot | |
| # ejecutable con bootRun, y que utiliza el puerto 8080 | |
| RUN mkdir -p /home/gradle/project | |
| COPY ./ /home/gradle/project | |
| WORKDIR /home/gradle/project |