Advertisement
Guest User

Untitled

a guest
Jan 31st, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.37 KB | None | 0 0
  1. Descargar e instalar las Heroku CLI (Heroku Command Line Interface)
  2.  
  3. https://devcenter.heroku.com/articles/heroku-cli#download-and-install
  4.  
  5.  
  6. Heroku CLI es un conjunto de herramientas que nos permitirán administrar nuestras
  7. aplicaciones de heroku a través de un terminal.
  8.  
  9.  
  10. Clonar el siguiente repositorio https://github.com/jesperorb/json-server-heroku:
  11.  
  12.  
  13. git clone https://github.com/jesperorb/json-server-heroku
  14.  
  15.  
  16. Una vez clonado el directorio, debemos ver los siguientes ficheros
  17.  
  18. E:\Scratch\json-server-heroku>dir
  19. El volumen de la unidad E es DATOS
  20. El número de serie del volumen es: 3E80-0DF6
  21.  
  22. Directorio de E:\Scratch\json-server-heroku
  23.  
  24. 28/01/2019 18:32 <DIR> .
  25. 28/01/2019 18:32 <DIR> ..
  26. 28/01/2019 18:32 244 db.json
  27. 28/01/2019 18:31 408 package.json
  28. 28/01/2019 18:31 6.946 README.md
  29. 28/01/2019 18:31 282 server.js
  30. 4 archivos 7.880 bytes
  31. 2 dirs 4.156.588.032 bytes libres
  32.  
  33.  
  34. Posteriormente modificamos el fichero db.json y añadimos nuestra base de datos:
  35.  
  36. {
  37. "Todos": [
  38. {
  39. "id": 1,
  40. "todo": "Pagar IGIC factura"
  41. },
  42. {
  43. "id": 2,
  44. "todo": "Redactar nueva propuesta"
  45. },
  46. {
  47. "id": 3,
  48. "todo": "Concretar reunión equipo de trabajo"
  49. }
  50. ]
  51. }
  52.  
  53. Ahora tenemos que commitear nuestros cambios:
  54.  
  55. E:\Scratch\json-server-heroku>git status
  56. On branch master
  57. Your branch is up-to-date with 'origin/master'.
  58. Changes not staged for commit:
  59. (use "git add <file>..." to update what will be committed)
  60. (use "git checkout -- <file>..." to discard changes in working directory)
  61.  
  62. modified: db.json
  63.  
  64. no changes added to commit (use "git add" and/or "git commit -a")
  65.  
  66. E:\Scratch\json-server-heroku>git add .
  67.  
  68. E:\Scratch\json-server-heroku>git commit -m "Base de datos para todo-app modificada"
  69.  
  70. *** Please tell me who you are.
  71.  
  72. Run
  73.  
  74. git config --global user.email "you@example.com"
  75. git config --global user.name "Your Name"
  76.  
  77. to set your account's default identity.
  78. Omit --global to set the identity only in this repository.
  79.  
  80. fatal: unable to auto-detect email address (got 'jgargon@DESKTOP-O0N3N4V.(none)')
  81.  
  82.  
  83. Para poder realizar un commit es necesario configurar los parámetros user.email y user.name:
  84.  
  85. E:\Scratch\json-server-heroku>git config --global user.email jonaygarciav@gmail.com
  86.  
  87. E:\Scratch\json-server-heroku>git config --global user.name "Jonay Garcia"
  88.  
  89. E:\Scratch\json-server-heroku>git commit -m "Base de datos para todo-app modificada"
  90. [master 0f398f4] Base de datos para todo-app modificada
  91. 1 file changed, 10 insertions(+), 10 deletions(-)
  92.  
  93.  
  94. Vemos que hemos hecho de manera correcta el commit:
  95.  
  96.  
  97. E:\Scratch\json-server-heroku>git log -1 --stat
  98. commit 0f398f4eb3527caa52bbba8eefabb1862941b88f
  99. Author: Jonay Garcia <jonaygarciav@gmail.com>
  100. Date: Mon Jan 28 18:35:37 2019 +0000
  101.  
  102. Base de datos para todo-app modificada
  103.  
  104. db.json | 20 ++++++++++----------
  105. 1 file changed, 10 insertions(+), 10 deletions(-)
  106.  
  107.  
  108. Nos logueamos en Heroku y creamos la app todoapp01:
  109.  
  110.  
  111. E:\Scratch\json-server-heroku>heroku login
  112. heroku: Press any key to open up the browser to login or q to exit:
  113. Logging in... done
  114. Logged in as jgglez79@gmail.com
  115.  
  116. E:\Scratch\json-server-heroku>heroku create todoapp01
  117. Creating ⬢ todoapp01... done
  118. https://todoapp01.herokuapp.com/ | https://git.heroku.com/todoapp01.git
  119.  
  120.  
  121. Al crear la apliación, nos la ha conectado a nuestro repositorio:
  122.  
  123.  
  124. E:\Scratch\json-server-heroku>git remote -v
  125. heroku https://git.heroku.com/todoapp01.git (fetch)
  126. heroku https://git.heroku.com/todoapp01.git (push)
  127. origin https://github.com/jesperorb/json-server-heroku.git (fetch)
  128. origin https://github.com/jesperorb/json-server-heroku.git (push)
  129.  
  130.  
  131. Posteriormente subimos nuestro código a Heroku:
  132.  
  133. E:\Scratch\json-server-heroku>git push heroku master
  134. Counting objects: 55, done.
  135. Delta compression using up to 8 threads.
  136. Compressing objects: 100% (54/54), done.
  137. Writing objects: 100% (55/55), 11.14 KiB | 0 bytes/s, done.
  138. Total 55 (delta 20), reused 0 (delta 0)
  139. remote: Compressing source files... done.
  140. remote: Building source:
  141. remote:
  142. remote: -----> Node.js app detected
  143. remote:
  144. remote: -----> Creating runtime environment
  145. remote:
  146. remote: NPM_CONFIG_LOGLEVEL=error
  147. remote: NODE_ENV=production
  148. remote: NODE_MODULES_CACHE=true
  149. remote: NODE_VERBOSE=false
  150. remote:
  151. remote: -----> Installing binaries
  152. remote: engines.node (package.json): unspecified
  153. remote: engines.npm (package.json): unspecified (use default)
  154. remote:
  155. remote: Resolving node version 10.x...
  156. remote: Downloading and installing node 10.15.0...
  157. remote: Using default npm version: 6.4.1
  158. remote:
  159. remote: -----> Building dependencies
  160. remote: Installing node modules (package.json)
  161. remote: added 223 packages from 121 contributors and audited 444 packages in 7.022s
  162. remote: found 0 vulnerabilities
  163. remote:
  164. remote:
  165. remote: -----> Caching build
  166. remote: - node_modules
  167. remote:
  168. remote: -----> Pruning devDependencies
  169. remote: audited 444 packages in 2.066s
  170. remote: found 0 vulnerabilities
  171. remote:
  172. remote:
  173. remote: -----> Build succeeded!
  174. remote: -----> Discovering process types
  175. remote: Procfile declares types -> (none)
  176. remote: Default types for buildpack -> web
  177. remote:
  178. remote: -----> Compressing...
  179. remote: Done: 20.1M
  180. remote: -----> Launching...
  181. remote: Released v3
  182. remote: https://todoapp01.herokuapp.com/ deployed to Heroku
  183. remote:
  184. remote: Verifying deploy... done.
  185. To https://git.heroku.com/todoapp01.git
  186. * [new branch] master -> master
  187.  
  188.  
  189. Subimos nuestro código a Heroku:
  190.  
  191.  
  192. E:\Scratch\json-server-heroku>git push heroku master
  193.  
  194.  
  195. ------------------------
  196.  
  197.  
  198. https://todoapp01.herokuapp.com/Todos
  199. https://randomapi.com/documentation
  200.  
  201. https://github.com/codepath/android_guides/wiki/Consuming-APIs-with-Retrofit
  202. http://www.jsonschema2pojo.org/
  203. https://www.simplifiedcoding.net/retrofit-android-example/
  204. https://scotch.io/tutorials/json-server-as-a-fake-rest-api-in-frontend-development
  205. https://github.com/jesperorb/json-server-heroku
  206. https://code.tutsplus.com/es/tutorials/sending-data-with-retrofit-2-http-client-for-android--cms-27845
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement